Le Lundi 13 Février 2006 22:40, Dan Ingalls a écrit :
I take issue with the "of course" here. I defy anyone to demonstrate a significant (even detectable) speedup of == over = between SmallIntegers on any meaningful benchmark.
Just to confirm Dan says, i did this in VW 7.3 and squeak 3.8
| 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.