Previously in morphic performance I benchmarked different actions in Squeak Smalltalk for creating, hiding, showing and deleting morphs in Squeak.
On [squeak-dev] Herbert Konig wrote: “Juan Vuletich has done a great job at simplifying cleaning and speeding up his version of Morphic in Cuis.”
So lets check that out. We should compare some other flavours of Smalltalk. The code used to generated the graph data is the same “V1″ code as used for morphic performance. The software versions tested here are:
Some interesting points are:
- Cuis is the fastest for creating, hiding and showing morphs. For deleting morphs Cuis is no faster than non-cog Pharo/Squeak, following the same exponential curve.
- Pharo-CogVM is by far the fastest at deleting morphs, near the fastest at creating morphs, but much slower at hiding and showing morphs.
- Non-CogVM Squeak and Pharo are very similar throughout the four graphs, with Pharo being slightly faster. Both increase exponentially for creating & deleting morphs. I’m not sure what to make of the smoother Pharo curves.
An update will follow to include the effect of Juan Vuletich’s “addAllMorphs” performance tweak of the original code.
Update 31 March 2011
I updated the original morphic performance article with Juan Vuletich’s addAllMorphs performance tweak. It will be interesting to see how that compares across flavours of Squeak.
In addition, for some flavours of Squeak the previous code didn’t display any morphs at all. It seemed that the tightness of the creation/deletion loops might have optimised away the actual drawing of the morphs. I don’t expect that is how applications would operate so the results would be skewed. More fair I think is to force a redraw between each of the four tests, where I’ve added doOneCycle below. What do you think?
rand := Random new. creating := [ m := EllipseMorph new. ellipses add: m. m color: Color random. m position: ActiveWorld extent * ((rand next)@(rand next)) ]. deleting := [ World removeAllMorphsIn: ellipses. ]. hiding := [ ellipses do: [ :item | item hide ]]. showing := [ ellipses do: [ :item | item show ]]. Transcript show: 'Morphic Performance Test Code v3.0 - ##FLAVOUR## '; cr. Transcript show: 'amount, createTime, hideTime, showTime, deleteTime'; cr. #( 1 10 100 200 300 400 500 600 700 800 900 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 30000 100000) do: [ :amount | ellipses := OrderedCollection new. createTime := [ amount timesRepeat: creating. World addAllMorphs: ellipses. ActiveWorld doOneCycle. ] timeToRun . hideTime := [ hiding value. ActiveWorld doOneCycle. ] timeToRun . showTime := [ showing value. ActiveWorld doOneCycle. ] timeToRun. deleteTime := [ deleting value. ActiveWorld doOneCycle. ] timeToRun. Transcript show: amount asString, ', ', createTime asString, ', ', hideTime asString, ', ', showTime asString, ', ', deleteTime asString; cr. ]
It is intriguing how very straight the lines are now in Figure 2 compared to Figure 1. Somehow I feel like something must be wrong. Anyhow, thanks to Juan’s suggestions, as well as being ten times faster, the graph shape is now linear rather than exponential - a much better prospect for system scaling.
Also interesting is how similar the flavours of Squeak are now. For up to 30,000 morphs the createTime is identical for all four flavours. After that performance does diverge, with Cog being fastest, Squeak & Cuis together in the middle and Pharo the slowest at about half the speed of the Cog.
Strangely, Cog has a hideTime four times slower than the other three. For showTime, both versions of Pharo (Std & Cog) are together twice as fast as Cuis and Squeak.
Test platform was Windows 7 Professional 32-bit Intel Core2Duo P8700 2.53Ghz 3GB RAM with graphics from Mobile Intel 4 Series Express Chipset.
I am interested in your observations. Can you replicate these results?
(graphs can be attached to comments)