> Being an FP nut used to using folds, I'm always a little annoyed that
> inject fares so poorly in these things; mainly we're just lacking a
> C implementation of Array#inject.coming back to this point... what do you mean by we're missing a C
impl of Array#inject? Granted, the impl is on Enumerable, but I
wouldn't think it would make THAT much of a difference... But I try my
best not to speculate (ever), so...(my C coding skills absolutely suck these days, please point out
improvements)
...
# # of iterations = 1000000
# user system total real
# null_time 0.130000 0.000000 0.130000 ( 0.129965)
# split/each/<< 10.940000 0.010000 10.950000 ( 10.968329)
# split/inject/<< 15.280000 0.020000 15.300000 ( 15.330062)
# split/new_inject/<< 15.020000 0.070000 15.090000 ( 15.629343)
uname -a
Linux linux116.ctc.com 2.6.18-53.1.13.el5 #1 SMP Tue Feb 12 13:01:45
EST 2008 i686 i686 i386 GNU/Linux
ruby -v
ruby 1.8.5 (2006-08-25) [i386-linux]
gcc -v
gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)
# of iterations = 1000
user system total real
null_time 0.010000 0.000000 0.010000 ( 0.000750)
split/each/<< 0.010000 0.000000 0.010000 ( 0.015283)
split/inject/<< 0.020000 0.000000 0.020000 ( 0.027374)
split/new_inject/<< 0.020000 0.000000 0.020000 ( 0.016135)
# of iterations = 10000
user system total real
null_time 0.010000 0.000000 0.010000 ( 0.007443)
split/each/<< 0.120000 0.040000 0.160000 ( 0.166371)
split/inject/<< 0.180000 0.060000 0.240000 ( 0.232431)
split/new_inject/<< 0.140000 0.030000 0.170000 ( 0.173137)
# of iterations = 100000
user system total real
null_time 0.040000 0.030000 0.070000 ( 0.075336)
split/each/<< 1.260000 0.370000 1.630000 ( 1.641662)
split/inject/<< 1.670000 0.500000 2.170000 ( 2.184967)
split/new_inject/<< 1.390000 0.350000 1.740000 ( 1.755857)
# of iterations = 1000000
user system total real
null_time 0.390000 0.320000 0.710000 ( 0.770740)
split/each/<< 12.490000 3.530000 16.020000 ( 16.168579)
split/inject/<< 16.720000 5.100000 21.820000 ( 22.276735)
split/new_inject/<< 13.800000 3.500000 17.300000 ( 17.358260)
# of iterations = 10000000
user system total real
null_time 4.350000 3.030000 7.380000 ( 7.429744)
split/each/<< 125.350000 35.750000 161.100000 (162.263233)
split/inject/<< 166.610000 51.400000 218.010000 (219.308560)
split/new_inject/<< 135.410000 36.080000 171.490000 (171.935555)
···
On Thu, Feb 21, 2008 at 4:00 AM, Ryan Davis <ryand-ruby@zenspider.com> wrote:
On Feb 20, 2008, at 15:12 , MenTaLguY wrote: