- or download this
use Benchmark;
...
'5 Sub (Ref)' => 'for (1..$b) { doSubR(\$_); $trash = $_ };',
'6 Sub (Val)' => 'for (1..$b) { $trash = doSubV($_) };',
});
- or download this
[lexicon]$ perl bench.pl 10 1000000
A = 10 B = 1000000
...
4 Hash : 184 wallclock secs (156.99 usr + 0.60 sys = 157.59 CPU)
5 Sub (Ref): 388 wallclock secs (327.87 usr + 1.30 sys = 329.17 CPU)
6 Sub (Val): 312 wallclock secs (266.54 usr + 1.02 sys = 267.56 CPU)
- or download this
Function Time(S) Relative
Mult: 19 01.00
...
Hash: 127 06.68
Sub (R): 299 15.70
Sub (V): 237 12.47