From: Patrick Put Date: 2009-02-02T20:38:59+09:00 Subject: Re: Quicker finding strings? Alternative for array, hash, set? > Rehearsal ----------------------------------------------------------- > Array#find existing 3.160000 0.700000 3.860000 ( 3.870061) > Array#find non-existing 6.280000 1.630000 7.910000 ( 7.935304) > Hash#[] existing 0.000000 0.000000 0.000000 ( 0.000019) > Hash#[] non-existing 0.000000 0.000000 0.000000 ( 0.000018) > ------------------------------------------------- total: 11.770000sec > > user system total real > Array#find existing 3.130000 0.710000 3.840000 ( 3.866618) > Array#find non-existing 5.820000 1.580000 7.400000 ( 9.195417) > Hash#[] existing 0.000000 0.000000 0.000000 ( 0.000030) > Hash#[] non-existing 0.000000 0.000000 0.000000 ( 0.000032) That is impressive indeed! No need for any other containers here I guess. ;-) Thanks for showing me this! I ran a program over some 1.8 billion lines of data this weekend. Good thing it was more slowed down because of IO than my Ruby programming. It would have been faster of course, but the damage is not that big... -- Posted via http://www.ruby-forum.com/.