nicolas cellier ncellier@ifrance.com wrote: ...
| t1 t2 t3 | t1 := Time millisecondsToRun: [10000000 timesRepeat: [#(1 2 3 4) isEmpty]]. t2 := Time millisecondsToRun: [10000000 timesRepeat: [#(1 2 3 4) size = 0]]. t3 := Time millisecondsToRun: [10000000 timesRepeat: [#(1 2 3 4) size == 0]]. ^Array with: t1 with: t2 with: t3
VW: #(627 311 291) #(693 302 292)
Squeak: #(6619 3959 4146) #(6558 3976 4126)
If such optimization matter, should be at the VM level... need a guru for JIT, method cache or something we have not yet... but don't bother too much at upper level.
In Squeak 3.8, #== seems to be even slower than #=. The same here: #(4941 3081 3101). But in Squeak 1.18, I've got #(8977 5313 4923), both with 3.7.7 Unix-VM resp. 1.18 Unix-VM.
Greetings and thank you, tim, for your convincing answer.
Wolfgang Helbig