Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Re: Re: Optimizing existing Perl code (in practise)

by Anonymous Monk
on Aug 20, 2002 at 15:57 UTC ( [id://191492]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Optimizing existing Perl code (in practise)
in thread Optimizing existing Perl code (in practise)

No the do not perform the same function. Your re method functions as a gaurd clause allowing for a) early failure and b) avoiding assignment on failure. The split version performs the assignment even if the strings do not match the pattern. If your data is always going to pass the re, then the split version would be the faster version (and even better than your split version would be  split " ", $foo). Care to show your benchmark where the re version was 90% faster?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-19 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found