|Keep It Simple, Stupid|
(tye)Re: Benchmarking the basic operationsby tye (Sage)
|on Jan 24, 2001 at 23:58 UTC||Need Help??|
<sarcasm>Yes, then we could make our programs run faster with:
Please run the benchmarks 5 times with the order in which the different tests are run changed each time (prepend different letters to each case as Benchmark.pm runs them in order sorted by name). Then you can try to interpet the numbers. It wouldn't surprise me if the optimizer removed those operations anyway and you are just timing a bunch of loops.
It is quite normal for the exact same operation to benchmark 5% or even more different each time you try. This is especially true of tiny things like what you are trying to benchmark.
It just so happens that these are also the types of things that you don't want to optimize.
Comparing the speed of lt, gt, ge, le, ne, and eq is just, well, silly. The difference comes down to a fraction of a machine language instruction. The time it takes to dispatch a single Perl opcode dwarfs that like a flea on an aircraft carrier.
Some of the other comparisons might be interesting if the benchmarking code and results were shown to be actually doing a comparison. But I want to stress that this is not the type of stuff you should even think about when trying to make your code run faster.
Okay, I feel slightly better. Now back to our regularly schedule trolling^Wdownvoting^Wscholarly discussions. (:- tye (but my friends call me "Tye")