Strongtalk seems very interesting. It is a version of smalltalk that uses runtime type feedback for optimization and also has static typing.
A great interview is online here:
http://www.cincomsmalltalk.com/audio/2007/industry_misinterpretations-01-14-07.mp3
The conclusion is that static typing doesn't improve the performance very much. A problem with smalltalk systems is that they causes you
Interface based type systems are not good for performance, implementation based type systems are good for performance but not good for programming. The Self compiler would compile all code and this would take a lot of space, 64M on bootup which was a lot for the early 90's. A significant improvement in Strongtalk was that it only compiles code that is used a lot.
Smalltalk like languages have a much higher call frequency than Java. This is because the language provide mechanisms for constructing your own control structures. Type feedback keeps statistics at every call site and then does a jump and compare rather than dereferenced call which stalls the pipeline. In fact one doesn't even have to jump, one can just compare and go straight into the inlined code.
Stack allocation is much more efficient than heap allocation. Strongtalk manages to to do stack allocation by doing escape analysis. It can determine that a stack frame does not need to be allocated on the heap.
With inlining it becomes possible to do range check removal on the inlined code.
Megamorphic means that a callsite calls several different methods. If there is a small number of methods then each one can be inlined. However it turns out that very few calls have much impact on program performance. Most of the gain is in optimizing monomorphic sites.
Another optimization technique is "customization": methods are copied down into child classes then self calls to the method become monomorphic. Double dispatch is another technique: call a method and pass self, then the method calls you back. These dispatches can be removed using by inlining, because one inlining leads to another.
So far there are no smalltalks vm's which are multithreaded. One idea is to go multiprocess vs multithreaded. This probably works well in conjunction with green threads.
In a discussion about .NET, the criticism is that CLR doesn't permit inlining because it supports legacy languages such as C and C++. The CLR seems to have changed to using inline caching, which is a technique related to inlining. A VM which is highly tuned to Java or C# doesn't work well for languages like smalltalk; no tagged types, and different method of dispatching.
Sunday, April 29, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment