Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: Regex, capturing variables vs. speed

by robin (Chaplain)
on Oct 30, 2005 at 20:31 UTC ( #504038=note: print w/replies, xml ) Need Help??


in reply to Re^2: Regex, capturing variables vs. speed
in thread Regex, capturing variables vs. speed

Even faster is to use a single match, but to be explicit about what you're looking for, i.e.
'Better' => sub { $line =~ /(chr\S*).*?urn:lsid:(\S*).*?panel:([^:]*)/i }
It's always better to write (\S*)\s than (.*?)\s, because you're making it clear to the matching engine exactly what you're looking for (non-space characters in this case).

Replies are listed 'Best First'.
Re^4: Regex, capturing variables vs. speed
by albert (Monk) on Oct 30, 2005 at 21:06 UTC
    Thanks. Speed yet better as you say....
    Rate Sep Non Death_star Better Sep 158510/s -- -10% -23% -65% Non 175363/s 11% -- -15% -61% Death_star 206769/s 30% 18% -- -54% Better 449757/s 184% 156% 118% --
    -albert

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://504038]
help
Chatterbox?
[TCLion]: Good Morning Monks, I am parsing logs and some date time formats are inconsistent. I am trying to make output all same format. What is the best way to convert a month(word) to month(number)?
[Corion]: TCLion: I'm not aware of a better way than manually building the hash, as all strptime incarnations I know have nasty edge cases

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (15)
As of 2017-03-23 14:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (287 votes). Check out past polls.