Squeak primitives

Jesse Welton jwelton at pacific.mps.ohio-state.edu
Fri Aug 12 02:53:01 UTC 2005


On Thu, Aug 11, 2005 at 09:04:40PM +0100, Bryce Kampjes wrote:
> 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.

Don't we essentially use compact SmallIntegers as a size optimization?
They save object header space.  If they were to improve computation
efficiency at all, I'd think it would be through reducing the work of
the allocator and GC.  Oh, and they save an indirection.

The real issue isn't the use of primitive types, it's the use of
primitive types that don't participate in the object system, isn't it?
How many instructions do we pay for a dynamic message dispatch vs.
static lookup or bytecodes?  It's a lot easier on the compiler witers
to make it fast if they don't have to accommodate all that dynamism,
and a lot of programmers just don't care all that much about losing
it.

-Jesse



More information about the Squeak-dev mailing list