Squeak primitives

Bryce Kampjes bryce at kampjes.demon.co.uk
Thu Aug 11 20:04:40 UTC 2005


Blake writes:
 > I was having two difficulties with it:
 > 
 > 1. Isn't Smalltalk basically competitive with C#? Yeah, it's slower, but  
 > not as much slower as, say, VB has been over the years. And it's not  
 > nearly as slow as Python or Ruby, which are currently far more popular.
 > 
 > 2. Doesn't Smalltalk have primitive strings, ints, bools, etc?

I doubt that primitive types provide much in the way of speed
improvements. Worst case, having SmallInteger objects costs four extra
instructions per operation (5 on the x86) but that can be reduced to
one extra instruction in many cases. C programs often only execute one
instruction per clock on modern 3 issue machines, there is room for a
little slack so long as it doesn't stall the pipelines.

The hardest part to optimise is the last overflow check but then a
safe language may want to keep that even with primitive types. The
type overhead is easy to remove with the appropriate intermediate
representation. Exupery could easily remove tagging between integer
operations in the same expression. With SSA it would be easy to remove
tagging across expressions. Much more compilation machinery is
required to remove array bounds checks. Do Java and C# allow unsafe
array accesses for speed?

Bryce

P.S. The tag checking numbers above assume that the integer tag is 0
not 1. As this is arguing about design, that seems fair.



More information about the Squeak-dev mailing list