From: "Mladen Jablanović" Date: 2009-07-29T03:15:13+09:00 Subject: Re: Indexing hash with longer strings faster? First, thanks a lot for your benchmarking tips, I'm new in the business; and thanks for your BM-friendly rewrite of my code. However, I still keep getting unexpected results: jablan-mbp:dev $ ruby bm1.rb Rehearsal ------------------------------------------- 2 chars 0.840000 0.000000 0.840000 ( 0.863001) 7 chars 0.590000 0.010000 0.600000 ( 0.597103) ---------------------------------- total: 1.440000sec user system total real 2 chars 0.900000 0.000000 0.900000 ( 0.909053) 7 chars 0.620000 0.000000 0.620000 ( 0.644989) Rehearsal ------------------------------------------- 2 chars 0.910000 0.000000 0.910000 ( 0.924786) 7 chars 0.620000 0.010000 0.630000 ( 0.631793) ---------------------------------- total: 1.540000sec user system total real 2 chars 0.900000 0.000000 0.900000 ( 0.909935) 7 chars 0.570000 0.000000 0.570000 ( 0.578445) Rehearsal ------------------------------------------- 2 chars 0.880000 0.010000 0.890000 ( 0.892464) 7 chars 0.650000 0.000000 0.650000 ( 0.672226) ---------------------------------- total: 1.540000sec user system total real 2 chars 0.910000 0.010000 0.920000 ( 0.947815) 7 chars 0.580000 0.000000 0.580000 ( 0.593960) Rehearsal ------------------------------------------- 2 chars 0.890000 0.010000 0.900000 ( 0.896618) 7 chars 0.650000 0.000000 0.650000 ( 0.660125) ---------------------------------- total: 1.550000sec user system total real 2 chars 0.900000 0.000000 0.900000 ( 0.919042) 7 chars 0.590000 0.010000 0.600000 ( 0.595202) Rehearsal ------------------------------------------- 2 chars 0.900000 0.000000 0.900000 ( 0.913919) 7 chars 0.660000 0.010000 0.670000 ( 0.682484) ---------------------------------- total: 1.570000sec user system total real 2 chars 0.920000 0.000000 0.920000 ( 0.950286) 7 chars 0.590000 0.010000 0.600000 ( 0.601025) I will try to run the code on other platforms and/or ruby versions and I will post the findings... The bad thing is that I'm not doing this just for kicks, I need to optimise a nasty script... :(