So I got around to benchmarking today. I was struck by the
large variability in the benchmarks--2 orders of magnitude
difference. So can someone explain why tadman's and MeowChow's
subs are so much faster?
tadman original:
|
timethis 100000: 70 wallclock secs (70.00 usr + 0.02 sys = 70.02 CPU) @ 1428.16/s (n=100000)
|
MeowChow:
|
timethis 100000: 13 wallclock secs (12.25 usr + 0.00 sys = 12.25 CPU) @ 8163.27/s (n=100000)
|
no_slogan:
|
timethis 100000: 81 wallclock secs (78.22 usr + 0.04 sys = 78.26 CPU) @ 1277.79/s (n=100000)
|
srawls:
|
timethis 100000: 56 wallclock secs (53.80 usr + 0.07 sys = 53.87 CPU) @ 1856.32/s (n=100000)
|
tachyon:
|
timethis 100000: 90 wallclock secs (89.07 usr + 0.06 sys = 89.13 CPU) @ 1121.96/s (n=100000)
|
tadman golf:
|
timethis 100000: 1 wallclock secs ( 0.83 usr + 0.00 sys = 0.83 CPU) @ 120481.93/s (n=100000)
|
Scott
Experimental method:
I placed each sub in a holder script and executed it. The
script looked like this:
#!/usr/bin/perl
use Benchmark;
my $iter=100000;
while (<DATA>){ #tadman original
timethis($iter, sub {
$_=pop;y/UCAG/0123/;s/(.)(.)(.)/substr
"FFLLSSSSYY..CC.WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG"
,$1<<4|$2<<2|$3,1/ge;y/0123//d;$_
});
}
__DATA__
yada yada... the CFTR mRNA from above.