On 6/20/2010 3:11 PM, Stéphane Rollandin wrote:
A naive question: are there now specific coding guidelines for getting the best out of the JIT, or can we go and code as usual and expect all methods to run much faster automatically ?
The latter. You should expect a 2-3x performance improvement in pretty much any kind of code (more towards 2x when running primitive and I/O bound stuff; more torwards 3x when running "pure" Smalltalk code).
Examples of non-I/O bound stuff:
[Smalltalk browseAllCallsOn: #do:] timeToRun.
Squeak: 779 CogVM: 258
[Morph methodsDo:[:meth| meth decompileString]] timeToRun.
Squeak: 537 CogVM: 166
Examples of I/O heavy stuff:
[Morph compileAll] timeToRun.
Squeak: 1510 CogVM: 766
[saveMorphs := World submorphs. World removeAllMorphs."heh, heh" time := [1 to: 10 do: [:i | Browser fullOnClass: SystemDictionary selector: #macroBenchmarks]. World submorphs do: [:m | m delete. self currentWorld doOneCycle]. ] timeToRun ] ensure:[World addAllMorphs: saveMorphs].
Squeak: 2633 CogVM: 1445
As usual for benchmarks YMMV slightly depending on what you're doing but I'd be surprised if you wouldn't get a 2-3x performance boost regardless of what you're doing.
Cheers, - Andreas