Does performance occur when using MooseX :: Declare mainly occurs when it does its original magic (ie, "translating" a definition into standard Perl syntax)? that is, after compilation is completed and the runtime is initially set, is there a performance difference when calling the MooseX :: Declare method and the method defined using the traditional declaration?
Answer: yes and no. Because MooseX :: Declare uses MooseX :: Method :: Signatures to perform unpacking and parameter checking, there is an overhead at runtime compared to no parameter checking at all.
But if your idea of a “traditional declaration” involves checking the number and type of your parameters (and also if you need reliable code), then there is no reason to believe that MXD / MXMS verification will be slower than the validation that you would do yourself.
MooseX :: Declare is a conversion of compilation time of declarative syntax to the "true" Perl code. All its overhead is at compile time.
, , Moose. : , is coerce. , , MooseX:: .
is coerce
, /. , . - , , , , .