Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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: (13)
As of 2014-12-17 22:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (37 votes), past polls