Re: [SPOILER] Solution to Perl 'Expert' Quiz-of-the-Week #22
"John J. Trammell" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.qotw.discuss |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Aug 30, 2004 at 04:44:12AM -0400, Randy W. Sims wrote:
[snip]
> Benchmark: timing 10 iterations of compound, simple...
> compound: 866 wallclock secs (726.63 usr + 0.94 sys = 727.57 CPU) @ > 0.01/s (n=10)
> simple: 4 wallclock secs ( 3.52 usr + 0.05 sys = 3.58 CPU) @ > 2.80/s (n=10)
> s/iter compound simple
> compound 72.8 -- -100%
> simple 0.358 20246% --
That's odd--when I run that benchmark, I get about a factor of two:
Benchmark: timing 20 iterations of compound, simple...
compound: 8 wallclock secs ( 7.70 usr + 0.06 sys = 7.76 CPU) @ 2.58/s (n=20)
simple: 4 wallclock secs ( 4.13 usr + 0.05 sys = 4.18 CPU) @ 4.78/s (n=20)
Rate compound simple
compound 2.58/s -- -46%
simple 4.78/s 86% --
That's on perl 5.6.1; on 5.8.4 the difference is a little more
pronounced (more like a factor of 3).