Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Answer: Regex anchor speed ?: Is /^.*X/ faster than /X/ ?

( #40700=categorized answer: print w/ replies, xml ) Need Help??

Q&A > regular expressions > Regex anchor speed ?: Is /^.*X/ faster than /X/ ? contributed by extremely

I'd think about using:  &Frobnitz($_) if index $_, '@'; instead. I got this:
        Rate regexp  index
regexp 826/s     --   -10%
index  921/s    11%     --

with Benchmark. Why throw the regex engine at a single character when there is lovely little function just for that? =)

Comment on Answer: Regex anchor speed ?: Is /^.*X/ faster than /X/ ?
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2014-09-21 21:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls