From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2003-05-30T17:47:02+09:00 Subject: Re: Array.extend versus instance.extend On Fri, 30 May 2003 11:16:14 +0200, Simon Strandgaard wrote: > > My earlier code says 'Time: 0.007166'.. so this > is a *slower* solution. Sorry not quite true :-) I ran Guillaume's speed test on the code ArrayMisc == the old code (not using detect) ArrayMisc2 == new code (using detect) All pop operations within ArrayMisc is slow. But shift operations seems to be faster with ArrayMisc. > ruby spt.rb Speed test with ArrayMisc shift 10000: 0.068033 pop 10000: 7.099999999999999e-05 shift 5000: 0.029729 pop 5000: 0.218009 shift 3333: 0.01859 pop 3333: 0.412474 shift 2500: 0.013405 pop 2500: 0.540523 shift 2000: 0.011306 pop 2000: 0.629184 shift 1666: 0.00953 pop 1666: 0.730164 shift 1428: 0.007726999999999999 pop 1428: 0.729752 shift 1250: 0.006794 pop 1250: 0.78048 shift 1111: 0.006069 pop 1111: 0.778281 shift 1000: 0.005391 pop 1000: 0.816113 Speed test with ArrayMisc2 shift 10000: 0.077073 pop 10000: 0.001267 shift 5000: 0.043104 pop 5000: 0.047606 shift 3333: 0.022285 pop 3333: 0.057452 shift 2500: 0.016819 pop 2500: 0.074443 shift 2000: 0.013847 pop 2000: 0.06378299999999999 shift 1666: 0.014762 pop 1666: 0.065674 shift 1428: 0.010433 pop 1428: 0.069156 shift 1250: 0.009172999999999999 pop 1250: 0.070936 shift 1111: 0.008364999999999999 pop 1111: 0.07146 shift 1000: 0.007538 pop 1000: 0.08437799999999999 > -- Simon Strandgaard