Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: Naughty match variables in CPAN?

by sauoq (Abbot)
on Jul 22, 2003 at 02:41 UTC ( [id://276568]=note: print w/replies, xml ) Need Help??


in reply to Re: Naughty match variables in CPAN?
in thread Naughty match variables in CPAN?

If I read that right, it means that the performance hit is only triggered once, the first time one uses them.

No. What that means is that once you use them, all matches will incur the overhead of using them whether or not you actually do. It's not a one-time hit but it is all-or-nothing.

(This is my 1000th post! :-)

-sauoq
"My two cents aren't worth a dime.";
  • Comment on Re: Re: Naughty match variables in CPAN?

Replies are listed 'Best First'.
Re: Re: Re: Naughty match variables in CPAN?
by Dog and Pony (Priest) on Jul 22, 2003 at 02:55 UTC
    Gotcha! I guess it is too late over here to read documentation. :)

    But I still wonder how much of a penalty there is.


    You have moved into a dark place.
    It is pitch black. You are likely to be eaten by a grue.

      Its apparently the same penalty incurred on a per-regex basis by using capturing. While working with Metacode::Reader I was able to get some very nice speedups by removing everything that copies data around. So instead of /H=(\d+)$/ I had substr $_, $-[0] + 2, $+[0] - $-[0] - 3. This is much less clear and not nice to read. In my case I was writing a high volumn database filter and the obfuscation was ok. I don't advocate at all taking this sort of step outside of really critical code that Devel::DProf has already highlighted as being slow.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://276568]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-25 11:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found