From: botp Date: 2008-02-07T14:35:18+09:00 Subject: Re: idiom I've not seen before On Feb 7, 2008 1:16 PM, Ryan Davis wrote: > > Buyer beware: > > # # of iterations = 10000 > # user system total real > # null_time 0.000000 0.000000 0.000000 ( 0.001561) > # map 0.880000 0.000000 0.880000 ( 0.878500) > # to_proc 2.790000 0.000000 2.790000 ( 2.799291) > > # # of iterations = 100000 > # user system total real > # null_time 0.020000 0.000000 0.020000 ( 0.013951) > # map 8.730000 0.010000 8.740000 ( 8.766693) > # to_proc 27.960000 0.030000 27.990000 ( 28.001288) that will change in ruby1.9 since to_proc is builtin. eg, a run in windows, C:\ruby1.9\bin>.\ruby.exe test.rb 1_000 # of iterations = 1000 user system total real null_time 0.000000 0.000000 0.000000 ( 0.000000) map 0.203000 0.000000 0.203000 ( 0.203000) to_proc 0.156000 0.000000 0.156000 ( 0.172000) C:\ruby1.9\bin>.\ruby.exe test.rb 10_000 # of iterations = 10000 user system total real null_time 0.016000 0.000000 0.016000 ( 0.015000) map 1.937000 0.000000 1.937000 ( 2.515000) to_proc 1.610000 0.000000 1.610000 ( 1.954000) C:\ruby1.9\bin>.\ruby.exe test.rb 100_000 # of iterations = 100000 user system total real null_time 0.328000 0.000000 0.328000 ( 0.328000) map 19.344000 0.000000 19.344000 ( 24.953000) to_proc 17.296000 0.015000 17.311000 ( 18.016000) not bad, imho. kind regards -botp