Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Benchmark.pm: Does subroutine testing order bias results?

by jlongino (Parson)
on Jul 12, 2004 at 04:50 UTC ( #373542=note: print w/ replies, xml ) Need Help??


in reply to Benchmark.pm: Does subroutine testing order bias results?

I posted a Meditation several years ago and there were many interesting points about benchmarking presented (questions posed by the respondents).

Some recommendations:

  • Try separating the two methods and use only timethis on each program. In each program vary what you are using the timethis on. E.G., once just like your listc subroutine is written. The next progrram might generate the data outside of the timethis block. Use timethis only on the computational snippet. If necessary, increase the number of data points, decrease the number of data points. Sometimes it is not obvious how a snippet will work when you tweak the characteristics of a data set. Some algorithms may work well on large dataset and poorly on smaller ones. Some may perform well with smaller data points than others.
  • Try not to include "my" statements in your timethis code. These portions of the code will add bloat to your results (bloat the timed elements and decrease the iterations). I'm not saying that you shouldn't have done it as you did above, just that it might be worthwhile doing it differently and analyzing the results. It is a "good thing" to benchmark it in a "real world" scenario.
  • Depending on how you intialize your data structures, you might need to be concerned about how your computer/OS caches data. Perform multiple iterations of each program (via a shell script or a batch file depending on your OS). It might even be worthwhile running a few programs in between that create large data sets. This might aid in preventing caching anomalies. I don't know how you generate your data set, so it may not apply to your situation.

    These are the things that come to mind immediately and I'm sure that there are many other things to consider as well. Good luck!


Comment on Re: Benchmark.pm: Does subroutine testing order bias results?
Re^2: Benchmark.pm: Does subroutine testing order bias results?
by jkeenan1 (Chaplain) on Jul 13, 2004 at 03:07 UTC
    "Some recommendations:
    "Try separating the two methods and use only timethis on each program. In each program vary what you are using the timethis on. E.G., once just like your listc subroutine is written."

    I am in the process of trying out your suggestion and, time permitting, I will post additional results in a few days. Thanks.

    Jim Keenan

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://373542]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2014-08-21 21:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (143 votes), past polls