Which perl did you use?
c:\test>perl -v This is perl, v5.8.6 built for MSWin32-x86-multi-thread (with 3 registered patches, see perl -V for more detail) Copyright 1987-2004, Larry Wall Binary build 811 provided by ActiveState Corp. http://www.ActiveState. +com ActiveState is a division of Sophos. Built Dec 13 2004 09:52:01
Things do seem to have swung the other way again with 5.10:
for( 30, 300, 3000, 30000 ) { $s = 'x'x$_ . 'reg exp' . 'x'x$_; cmpthese -1, { REGEX => q[ $x = $s =~ /reg exp/;], INDEX => q[ $x = index $s, 'reg exp';] } };; Rate REGEX INDEX REGEX 2526899/s -- -27% INDEX 3444838/s 36% -- Rate REGEX INDEX REGEX 1083665/s -- -9% INDEX 1193837/s 10% -- Rate REGEX INDEX REGEX 159444/s -- -3% INDEX 163587/s 3% -- Rate REGEX INDEX REGEX 14881/s -- -3% INDEX 15292/s 3% -- for( 30, 300, 3000, 30000 ) { $s = 'x'x$_ . 'reg exp' . 'x'x$_; study $s; cmpthese -1, { REGEX => q[ $x = $s =~ /reg exp/;], INDEX => q[ $x = index $s, 'reg exp';] } };; Rate REGEX INDEX REGEX 2103160/s -- -41% INDEX 3552278/s 69% -- Rate REGEX INDEX REGEX 806412/s -- -32% INDEX 1187789/s 47% -- Rate REGEX INDEX REGEX 110166/s -- -33% INDEX 163886/s 49% -- Rate REGEX INDEX REGEX 11587/s -- -24% INDEX 15292/s 32% --
In reply to Re^4: Performance optimization question
by BrowserUk
in thread Performance optimization question
by vit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |