Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Regular Expression Question (show me the can^H^H^Hbenchmark)

by simonm (Vicar)
on Dec 05, 2003 at 21:56 UTC ( [id://312666]=note: print w/replies, xml ) Need Help??


in reply to Re: Regular Expression Question (show me the can^H^H^Hbenchmark)
in thread Regular Expression Question

I'd be interested to see your benchmark (code + data), as I don't come to the same conclusion.

Test and output attached below. Looks like it is dependent on your data set...

use strict; use Benchmark 'cmpthese'; my @data = <DATA>; my @long = map { join '', $_ x 100 } @data; my %cases = ( 'Single' => sub { for ( @long ) { /^\w+(?:,\w+)*$/ } }, 'Double' => sub { for ( @long ) { /^[\w,]+$/ && ! /^,|,,|,$/ } }, ); cmpthese( 0, \%cases); __DATA__ !@#$as3dfa ,sdfas3df, asd3fsa,,a3sdf as3df,asdf3,3asdf,asd3f sad3fasdjasdfkasdfklas3jf 3sad3fasdjasdfkasdfklas3jf 3sad3fasdjasdfkasdfklas3jf3
          Rate Single Double
Single  6158/s     --   -83%
Double 35319/s   474%     --
  • Comment on Re: Re: Regular Expression Question (show me the can^H^H^Hbenchmark)
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-24 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found