Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by Fastolfe (Vicar)
on Nov 08, 2000 at 21:08 UTC ( #40552=note: print w/replies, xml ) Need Help??


in reply to Regex anchor speed ?: Is /^.*X/ faster than /X/ ?

I benchmarked it:

The string: "now is the time for all good monks to come to the aid of their perl". The results:

Benchmark: timing 5000000 iterations of /.*perl/, /^.*perl/, /perl/... /.*perl/: 43 secs (41.48 usr 0.00 sys = 41.48 cpu) /^.*perl/: 38 secs (36.20 usr 0.00 sys = 36.20 cpu) /perl/: 29 secs (28.96 usr 0.00 sys = 28.96 cpu)
So yah, a standalone /match/ is going to be a bit faster.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://40552]
help
Chatterbox?
[marinersk]: :-O
[marinersk]: That seems a bit harsh. A newspaper deletes a picture and you respond by deleting a whole city?
[LanX]: yep
[Corion]: First he deleted Bielefeld, now he threatens to delete Darmstadt!
[marinersk]: LOL
[Corion]: People claim that Bielefeld exists, but that's just a ploy to hide LanX's acts!

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2017-05-29 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?