Next | Making Programs Faster | 95 |
First, the benchmark code is way too complicated
I'll use this instead:
#!/usr/bin/perl -w use Benchmark; my $code = q{"x" . "y"};
timethese(8000, { 'Slow Eval' => sub {eval $code }, 'Fast Eval' => sub {eval {$code} } });
Benchmark: timing 8000 iterations of Fast Eval, Slow Eval... Fast Eval: 0 wallclock secs ( 0.02 usr + 0.00 sys = 0.02 CPU) @ 400000.00/s (n=8000) Slow Eval: 4 wallclock secs ( 3.43 usr + 0.00 sys = 3.43 CPU) @ 2332.36/s (n=8000)
Looks conclusive, doesn't it?
Anyone see the problem here?
Next | Copyright © 2003 M. J. Dominus |