On Wed, 10 Aug 2005 06:04:49 -0700, Dominique Dutoit dominiqued@versateladsl.be wrote:
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.
Well, he's working for Microsoft now; he has a lot of apologizing to do for .NET.<S>
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.
Like my daddy used to say, you never know where the bottlenecks are until you've tested.
- 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.
That's what I thought. I knew the "can't use pure objects" thing was malarkey. I remember getting acceptable (but not great) results from VisualAge Smalltalk back in '94.