Document eval vs. sub in Benchmark
Subject: Re: Patch for Benchmark.pm
In <
9704011547.AA29906@toad.ig.co.uk>, Tim Bunce writes:
:Simple: calling functions in perl is expensive.
Yeah, I simply hadn't expected it to be *that* expensive.
:> - ? "sub { package $pack; my(\$_i)=$n; while (\$_i--){&\$c;} }"
:> + ? "sub { package $pack; my(\$_i)=$n; while (\$_i--){&\$c();} }"
:It's cheaper to _not_ add () so I'd recommend leaving it off.
I considered that, but felt it was more correct not to pass through the
parameters that were received. My new patch ducks it, by shifting @_
out before it gets there.
I also looked at having two caches for empty string/empty sub timings,
but was unable to get satisfactory results. I'll come back to that one,
but I don't think it is urgent for 5.004.
This patch is for the Benchmark.pm in _96: it repeats stuff from my
previous patch, but avoids stuff that was obsoleted by other changes
in _96.
p5p-msgid:
199704012231.XAA00225@crypt.compulink.co.uk