[self-interest] Performance?

Jecel Assumpcao Jr jecel at merlintec.com
Fri Jul 2 23:00:41 UTC 2004

On Friday 02 July 2004 19:01, David Ungar wrote:
> What benchmarks are you running?

The bytecodes/sec number is coming from the standard "Sieve of 
Eratosthenes" prime number search, while the sends/sec is from the 
doubly recursive Fibonacci series calculation.

> I believe that bytecodes/sec can be a meaningless figure.

True. Its value to us is that these numbers are known from running 
Squeak on many different platforms. The original question was "how do 
Self and Squeak compare?" and the ease of obtaining results was too 
tempting. Since the Squeak numbers are only available as 
"bytecodes/sec", the Self version also prints these results so we can 

> Remember that in Smalltalk bitblt is one bytecode, and local variable
> access is one bytecode.

In this particular case the Self and Squeak bytecodes are very similar. 
Each iteration of the sieve executes 50,000 bytecodes in Squeak and I 
would expect something in the same order of magnitude for Self.

> When we did our benchmarking work, we took a (then) medium-sized
> program, Richards, and wrote it in optimized C++, and in several
> different styles in Self, varying in amount of object-orientedness.

This is what should be done here as well (or better yet, the actual 
application Michael is interested should be tested in both systems). 
Where are all the PhD students when we need them? ;-)

> Remember, that in a Self-style VM, sends to self of messages whose
> method bodies are small are free.

The sieve doesn't contain any interesting sends (only integer math and 
array indexing) and the recursion in Fibonacci doesn't allow inlining 
or even tail call optimization.

> Also, custom control structures you build run just as fast as ifTrue:
> while:, etc.
> Last time I looked, this was not true in Smalltalk VMs.

Squeak is a very traditional VM in this regard.

> So, if your benchmark uses a control structure
> that the ST compiler happens to replace with branch bytecodes, you do
> OK.
> But if not, you lose. I don't know if it is still true, but in ST-80,
> folks used to distort their code to use the "good" control structures.

These two benchmarks only use control structures that Squeak handles 
with jump bytecodes. They were selected to give a quick and dirty 
feedback during the development of the VM. Note that the original 
Smalltalk-80 benchmarks (macro and micro) are available as a package 
for Squeak, but since nobody runs them they don't help us. And even 
they aren't very good compared to the ones you mentioned.

-- Jecel

More information about the Self-interest mailing list