Squeak primitives

Dominique Dutoit dominiqued at versateladsl.be
Wed Aug 10 13:04:49 UTC 2005


> it's impossible (today, anyway) to make a language perform at a   
> level acceptable for most applications without primitive strings,  
> ints,  bools, etc.

His argument doesn't make sense. The performance gain resulting by  
the use of primitives instead of objets is marginal, simply because  
these primitives have to be manipulated by calling methods or  
functions and these operations are not cheap. Fast, maybe, but not  
dramatically faster.

> 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.

A while ago, I wanted to write a very simple freehand drawing program  
using a pen tablet as the main input device. The first version was  
written with Objective-C and it performed like any other programs I  
have seen: it was a bit jerky but acceptable on a G3 600 Mhz iBook.

The second version I made was written with a Cocoa-bridge for Ruby:  
no speed difference with the previous version, granted that it was a  
carbon copy of the Objective-C version, only with Ruby syntax.

When I wrote a plugin to access HID devices from Squeak, I made an  
example with code stripped from the previous support for pen tablets.  
This example is interesting because it keeps an history of the  
pressure put on the tip of the pen and does some computation to  
create a calligraphic-like effect, something missing in my previous  
attempts. And while a lot of messages are sent (Collection, Array,  
Morphic, plugin access), it is not slower than the Cocoa version,  
which is using primitives for handling the numbers.

> 2. Doesn't Smalltalk have primitive strings, ints, bools, etc?

Yes and no. Squeak has primitives for objects requiring heavy  
computation, or more exactly, plugins called by methods wanting a bit  
more punch from the processor. The plugins can be internal or  
external to the VM.



More information about the Squeak-dev mailing list