Joe said:
Hmmm. 'perldoc perlop' does not state whether the lack of /o has as
much of a performance impact in perl-5.8 as it had in earlier versions.
-Joe
a quick test with 5.8 on Solaris 9 shows very little difference.
use strict;
use warnings;
use Benchmark::Timer;
my $searchExpression=shift;
my $text=shift;
my $iterations=shift;
my $timer=Benchmark::Timer->new();
$timer->start("overall");
for(my $ii=0;$ii<$iterations;$ii++){
$timer->start("iteration");
$text=~/$searchExpression/;
$timer->stop("iteration");
$timer->start("iterationwitho");
$text=~/$searchExpression/o;
$timer->stop("iterationwitho");
}
$timer->stop("overall");
$timer->report();
redwood 24170 $ perl ./timere.pl ^asdf thisissometext 10000
1 trial of overall (1.014s total)
10000 trials of iteration (100.802ms total), 10us/trial
10000 trials of iterationwitho (98.526ms total), 9us/trial
redwood 24171 $ perl ./timere.pl ^asdf thisissometext 10000
1 trial of overall (1.011s total)
10000 trials of iteration (100.544ms total), 10us/trial
10000 trials of iterationwitho (96.909ms total), 9us/trial
redwood 24172 $ perl ./timere.pl ^asdf thisissometext 10000
1 trial of overall (938.571ms total)
10000 trials of iteration (93.197ms total), 9us/trial
10000 trials of iterationwitho (89.684ms total), 8us/trial
assuming my test is correct...
Mark