Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the performance hit with using MooseX::Declare mainly encountered during startup?

Tags:

perl

moose

Is the performance hit with using MooseX::Declare mainly encountered while it does its initial magic (i.e. "translating" the definition into standard Perl syntax)? i.e. once the compile and initial runtime setup is complete, is there a performance difference in calling a MooseX::Declare method vs a method defined via traditional declaration?

like image 757
Dan Horne Avatar asked Mar 30 '10 07:03

Dan Horne


1 Answers

The answer is yes and no. Since MooseX::Declare uses MooseX::Method::Signatures to do parameter unpacking and validation, there is a runtime overhead compared to not validating parameters at all.

But if your idea of "traditional declaration" includes validating the number and type of your parameters (and it should if you want robust code) then there's no reason to think that the validation MXD/MXMS does would be any slower than the validation you would do yourself.

like image 188
hobbs Avatar answered Sep 18 '22 17:09

hobbs