Daniel Sheppard
3/1/2007 5:33:00 AM
> I was curious if it just interates through one array looking for that
> element in the second, or does it (internally) sort the
> array, iterate
> each array performing comparision and if a > b skipping the equality
> determination to save CPU cycles and doing a 'next'.
I would guess that it would just do an include? call on the second array
and delete the element if it is true.
Doing the sort first would probably not be faster - a sort operation is
not a cheap operation, and there is no guarantee that the members of an
array are mutually sortable anyway (["a", 1, Object.new] for example) -
there is no way in which the '-' method would be able to rely on calling
the '<=>' method on its contents.
Dan.