Michael G Schwern wrote:

And the reverse is now true in this highly inaccurate test...

$ time perl5.8.8 -wle '$foo = "x" x 10000; $foo .= "T";  $foo =~ /[Tt]/ for
1..100000'

real    0m5.732s
user    0m5.565s
sys     0m0.027s

$ time perl5.8.8 -wle '$foo = "x" x 10000; $foo .= "T";  $foo =~ /t/i for
1..100000'

real    0m2.589s
user    0m2.544s
sys     0m0.015s

And if I recall my perl510delta correctly, /i should be even faster on 5.10.0. No, hang on, it's when UTF-8 strings are involved.

% time perl5.8.8 -Mutf8 -Mcharnames=:full -wle '$foo = "e\N{GREEK SMALL LETTER BETA}" x 5000; $foo .= "T"; $foo =~ /t/i for 1..1000'

real    0m22.855s
user    0m22.827s
sys     0m0.016s

% ./perl -v
This is perl, v5.10.0 DEVEL32604 built for i386-freebsd-thread-multi

% time ./perl -Ilib -Mutf8 -Mcharnames=:full -wle '$foo = "e\N{GREEK SMALL LETTER BETA}" x 5000; $foo .= "T"; $foo =~ /t/i for 1..1000'

real    0m22.957s
user    0m22.948s
sys     0m0.001s

Well, look on the bright side. It's no worse.

The benchmark may be flawed, since my appreciation of Unicode is little more than "things went downhill after 7-bit ASCII".

David

Reply via email to