[ENH] bench (was: Object turnover.)

Chris Muller afunkyobject at yahoo.com
Fri Dec 3 05:08:43 UTC 2004


> Should I worry about this object turnover, or is the system designed
> to handle this high object turnover?   Just trying to get my head
> around some of the issues of efficient squeak code..

The wonderful thing is, analyzing performance is a breeze in Squeak!  Check out
this changeset, it's just one method and is my favorite "quick benchmarking"
method.

  [ Array new: 100 ] bench  ----> '622021.595680864 per second.'
  [ Association allInstVarNames ] bench  ----> '77790.0419916017 per second.'
  [ "as fast as it can go" ] bench  ---->  '3.446075384923015e6 per second.'

It is much more useful and convenient than Time millisecondsToRun:

  - less typing, you can bench anything with one word, "bench"
  - it always runs in about five seconds, not 1 second or 5 minutes.  You get a
reasonable sample and a reasonable wait, every time, with NO guesswork.
  - it actually tells you how fast it is (executions / sec) instead of how long
it took providing a consistent measurement for different things benched over
time.

It's so easy I find myself frequently using it while coding a method and I
don't even trouble myself opening a workspace; I just type "bench" right there
where I'm at.

Cheers,
  Chris



More information about the Squeak-dev mailing list