Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Common Regex Gotchas

by Anonymous Monk
on May 08, 2001 at 19:26 UTC ( [id://78934]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Common Regex Gotchas
in thread Common Regex Gotchas

If I am not mistaken the Benchmark module is plagued by the "$& and friends". That means it makes the regexes slow by defualt. That means that the benchmarks you take are disproportionate and useless, since the ineffectiant single instance of $& ruins any optimizations perl can make on the substitution.

Replies are listed 'Best First'.
Re: Re: Re: Common Regex Gotchas
by chipmunk (Parson) on May 08, 2001 at 20:30 UTC
    Happily, that doesn't appear to be the case. I don't see any occurence of the $& et al. variables in the code for Benchmark.pm

    The real problem here is the use of /e on the substitution, when this would work just as well and be much more efficient: s/(\w+)/\U$1/g;

      I don't see any occurence of the $& et al. variables in the code for Benchmark.pm

      I think what our Anonymous friend means is that if one of the routines being benchmarked uses $&, then all routines suffer (unfairly) from the overhead.

        I'm pretty sure that the AM was referring to the module itself, especially since none of the code in this thread actually uses $& et al.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://78934]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.