On Sat, 11 Oct 2008 12:14:23 +1100, SASADA Koichi <ko1 / atdot.net> wrote:
> I committed such an optimization last night :) please check it.
Hi,
That's fantastic - the performances of "for" and "each" are now quite
similar, and as I suspected, for a very small loop like this benchmark,
"for" is just marginally slower due to the extra assignment of the dynamic
variable to the local.
Now:
ruby 1.9.0 (2008-10-11 revision 19756) [i686-linux]
user system total real
for 2.490000 0.000000 2.490000 ( 2.508887)
each 2.370000 0.000000 2.370000 ( 2.381762)
times 2.380000 0.010000 2.390000 ( 2.420313)
Was:
ruby 1.9.0 (2008-10-10 revision 19741) [i686-linux]
user system total real
for 6.030000 0.020000 6.050000 ( 6.074545)
each 2.380000 0.000000 2.380000 ( 2.384460)
times 2.380000 0.000000 2.380000 ( 2.394605)
Much better :)
Thanks very much
Mike