Perlについての質問箱 20箱目
■ このスレッドは過去ログ倉庫に格納されています
0119ヽ(´ー`)ノ ◆.ogCuANUcE
2005/11/14(月) 10:39:59int(3.987899)
>>115
固定長だと話にならんので、文字列長を求めるようにしたらこうなった。
use Benchmark;
my $s = "abcdef";
timethese(undef,
{
bitand => sub { $foo = $s & (length($s) x "_"); },
bitandfix => sub { $foo = $s & "______"; },
uc => sub { $foo = uc $s; },
}
);
Benchmark: running bitand, bitandfix, uc for at least 3 CPU seconds...
bitand: 2 wallclock secs ( 3.02 usr + 0.00 sys = 3.02 CPU) @ 2174994.70/s (n=6568484)
bitandfix: 2 wallclock secs ( 3.05 usr + 0.01 sys = 3.06 CPU) @ 3427579.08/s (n=10488392)
uc: 4 wallclock secs ( 3.01 usr + 0.02 sys = 3.03 CPU) @ 4279167.66/s (n=12965878)
■ このスレッドは過去ログ倉庫に格納されています