Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: Multiple Regex's on a Big Sequence - Benchmark

by borisz (Canon)
on Aug 17, 2006 at 10:56 UTC ( #567882=note: print w/replies, xml ) Need Help??

in reply to Re: Multiple Regex's on a Big Sequence - Benchmark
in thread Multiple Regex's on a Big Sequence

That looks wrong to me, since therre is no need to constuct the $ra 100 times. Try it this way. Also try it with more patterns or do you search only for two?
... my $t4 = new Benchmark; my $ra = Regexp::Assemble->new(); $ra->add(@strings); for (1..100) { while ( $sequence =~ /$ra/g) { my $val = pos($sequence) - 6; } }

Replies are listed 'Best First'.
Re^3: Multiple Regex's on a Big Sequence - Benchmark
by bernanke01 (Beadle) on Aug 18, 2006 at 02:01 UTC

    Hey, I'll try that. However, I figured that if it were a timing test I'd have to compare 100 repeats of everything, and that included construction of the RA. Otherwise it's an apples-to-oranges comparison where one method had the chance to do up-front work and the others didn't. I'll post benchmarks on that in a few minutes though and we can see if it makes a difference.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://567882]
[thezip]: Gosh my Unix is lacking these days... How can I get the line count of all CSV files contained within a directory hierarchy containing subdirectories of the CSV files?
[thezip]: Something like: xargs find . -mindepth 2 -name '*.csv' | wc -l or such?

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2016-12-06 17:55 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (113 votes). Check out past polls.