Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: alternation in regexes: to use or to avoid?

by dave_the_m (Monsignor)
on Dec 10, 2012 at 17:08 UTC ( [id://1008140]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $q1s = join('|', @matchwords);
    my $q1  = qr/$q1s\s*\w+/;
    
    my $q3s = join('|', @matchwords);
    my $q3  = qr/($q3s)\\s*\\w+/;
    
  2. or download this
    alternation, grouping:  1 wallclock secs ( 0.58 usr +  0.00 sys =  0.5
    +8 CPU) @ 1724137.93/s (n=1000000)
    alternation, no grouping:  5 wallclock secs ( 4.85 usr +  0.00 sys =  
    +4.85 CPU) @ 206185.57/s (n=1000000)
    loop, grouping: 24 wallclock secs (23.33 usr +  0.00 sys = 23.33 CPU) 
    +@ 42863.27/s (n=1000000)
    loop, no grouping: 23 wallclock secs (22.57 usr +  0.00 sys = 22.57 CP
    +U) @ 44306.60/s (n=1000000)
    

Log In?
Username:
Password:

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

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

    No recent polls found