|
|
| There's more than one way to do things | |
| PerlMonks |
Re^2: Slowdown when using Moose::Util::TypeConstraints with Regexp::Commonby kevbot (Friar) |
| on Sep 02, 2008 at 20:38 UTC ( #708592=note: print w/ replies, xml ) | Need Help?? |
|
I added a couple other tests (AddressC and AddressD) to the mix. Basically, I wanted to take Regexp::Common out of the code to see if a standard regexp showed the same behavior. So, I grabbed the regular expression from Regexp::Common and placed it in the code directly. In AddressC, I put it directly in the subtype (similar to Address A):
For AddressD, I compile the regexp (similar to AddressB): So, I would expect that AddressB and AddressD would be the fastest. Here the result of a benchmark on my WinXP/Strawberry Perl 5.10 setup:
The method using Regexp::Common directly in the Subtype is the slowest of all the techniques (AddressA). Basically, the other three are tied. So, the compiled regexp doesn't seem to make a difference as long as I avoid Regexp::Common.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||