Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^10: Speeding up named capture buffer access

by SBECK (Chaplain)
on Dec 01, 2009 at 19:29 UTC ( #810439=note: print w/replies, xml ) Need Help??

in reply to Re^9: Speeding up named capture buffer access
in thread Speeding up named capture buffer access

I created a very simple example that matched some simple times with a few different formats, and benchmarked it using named capture buffers, alternative capture group numbering, and your method with embedded code. The alternative capture method is about 40% faster than the named buffers (so I'm going to be implementing it for at least some of the regular expression matching where the order of the matches stays the same). The embedded code was significantly slower (7x) than the named buffers. It's possible I wasn't doing it as efficiently as possible, but given that:

    it appears to be significantly slower
    it's listed as an experimental feature
    the regular expressions are more complicated
I think that I'll pass on it for the time being. But it was fun to experiment with something new!

  • Comment on Re^10: Speeding up named capture buffer access

Replies are listed 'Best First'.
Re^11: Speeding up named capture buffer access
by ikegami (Pope) on Dec 01, 2009 at 19:49 UTC

    yeah, I figured the sub calls would significantly slow things down.

    The use of (?{}) doesn't complicate things. It's use is minimal, and it's use is the same for every subpattern. Using it just shifts code from outside the pattern into the pattern. Specifically, it removes the need to parse the returned values a second time in order to get numbers. However, the use of rc does complicate things.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2021-06-25 12:56 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (136 votes). Check out past polls.