>===== Original Message From ts <decoux / moulon.inra.fr> ===== >>>>> "B" == Benjamin J Tilly <ben_tilly / operamail.com> writes: > >B> I would think that a better optimization would be to instead >B> implement sort internally as a Schwartzian sort - do the method >B> lookups on the way in so they are immediately available inside. > > Do the method lookup on what ? The first element in the array ? > Take the list that is being sorted, and internally map each element to a pair, the first element being the method you get after doing a method lookup for <=> on the element, and the second being the element. Then in the sort you avoid the method lookups while finding the methods. And if you are clever you can try to make it so that if the method found is a C function, you just jump to that function through a function pointer. Which is presumably what will happen with class String... Cheers, Ben