[Melbourne-pm] Just how much does $& slow things down?
Alfie John
alfiejohn at gmail.com
Thu Nov 20 19:25:19 PST 2008
>From perlre:
WARNING: Once Perl sees that you need one of $&, $', or $' anywhere in
the program, it has to provide them for every pattern match. This
may
substantially slow your program.
This is the only place in the whole program which uses a regex, so the
> impact on other parts of the program should be nil.
> I just don't know if it's going to be worth removing those references to
> $&, and how much it will benefit the running of the program.
> Obviously, the bigger @an_array is, the larger the impact, but I can safely
> say it won't be much bigger than about 50.
> So, are we talking an order of magnitude slower? More? Less? Anybody even
> want to take an educated guess?
>
In other words, having it only in the above code will still impact *all
other* regexes in any code, including all imported modules.
Alfie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20081121/f4517060/attachment.html>
More information about the Melbourne-pm
mailing list