performance of 2.4 under Linux

Mike O'Brien obrien at rush.aero.org
Thu Jul 8 23:06:14 UTC 1999


Thomas Mahler sez:
> IMO this is a proof that the poor performance is not caused by Linux X
> Servers but must be caused by the Squeak Graphic implementation for
> Linux itself.

	Time for me to tell a story.  Many many years ago, I was
running the version of Smalltalk written at Berkeley on my Sun.
I also had a Xerox Dolphin running PARC Smalltalk.  The images
were substantially identical.

	The Sun was fast enough that it should have run rings around
the Dolphin.  In computational matters, it did.  However, in graphics,
the Dolphin ran rings around the Sun.  I thought, "Hey, hardware barrel
shifters rule!" and that was that.  For a while.

	Eventually I decided this might be bushwah, and went and
had a look at the Berkeley Smalltalk VM, which was written in C,
and to which I had the source.  drawLineFrom:to: was implemented
as a primitive, and the algorithm came straight from the Blue Book.
I put in a printf.  Imagine my surprise when the printf didn't print.
I put in more.  Nada.  After much sweating I discovered that there
was an argument type mismatch inside the primitive dispatching
routine.  The primitive was failing immediately and returning
control to the Smalltalk image, which ran backup Smalltalk code,
drawing the line by a sequence of dot: primitives.

	That's right, for years Berkeley Smalltalk drew all lines
as a series of dots.  The line-drawing primitive had NEVER RUN.  Ever.

	I proved this because, after I finished fixing the type
mismatch, the primitive did run, and did draw lines, and drew them all
in the wrong places.  The Blue Book algorithm is nonintuitive and about
half of its x's and y's are switched.  Whoever copied the algorithm
into C had missed this.

	When I got it all fixed, the Sun quite properly blew the
Dolphin out of the water in all phases of Smalltalk, including
graphics.

	THEREFORE, if Linux is a whole lot slower than Windows on
the same hardware, I posit that one or more Linux primitives are
silently failing, and being handled by backup Smalltalk code, at
a tremendous performance penalty.

Mike O'Brien





More information about the Squeak-dev mailing list