From: Owen <[EMAIL PROTECTED]>
> My first foray into Benchmark with the code below produced these
> results; 
> 
> The file is 22000 lines, and there are 2 matches in the file.
> 
> [EMAIL PROTECTED] PerlScripts]$ perl benchmark.pl
> 
> Regex with modifer
> YES
> YES
> timethis 1000000:  5 wallclock secs ( 4.84 usr +  0.50 sys =  5.34
> CPU) @ 187265.92/s (n=1000000)
> 
> Regex without  modifer
> YES
> YES
> timethis 1000000:  7 wallclock secs ( 4.75 usr +  0.57 sys =  5.32
> CPU) @ 187969.92/s (n=1000000)
> 
> It would seem to me that the /o modifier makes little difference, or
> is it that I am using the modifer incorrectly or even using Benchmark
> incorrectly?

There are two reasons why do you see such a small difference.

1) The regexp is very very simple. Try to change $name to 
'S(?:T.[lL]|TALE?)'. This should make the difference bigger.


2) The script spends a lot of time in reading the file. Try to read 
the whole file into an array first and then benchmark matching the 
items of the array.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to