------art_46131_20705676.1164254075567
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 11/23/06, Darshan.Ishaya <Darshan.Ishaya / gmail.com> wrote:
>
> The Coolest Way:
>
> def same_elems?(array1, array2)
>   return false unless array1.length array2.length
>
>   compare  roc.new do |x,y|
>     if (x.class y.class)
>       x <y
>     else
>       x.class.to_s <y.class.to_s
>     end
>   end
>
>   return array1.sort(&compare) array2.sort(&compare)
> end



That is cool.

It's conceptually simple, but I have no idea how it compares in speed
> to the other ways.  Can anyone give me a tip on a good way to
> benchmark?


There is a benchmarking class built into core

the docs are at
http://www.ruby-doc.org/core/classes/Benchmark.html

There are a couple of examples there of its usage too.

thanx for your help with this one

------art_46131_20705676.1164254075567--