Performance horrors

Adrian Hey ahey at iee.org
Tue Aug 26 20:30:34 EDT 2008


John Meacham wrote:
> nub has a couple advantages over the n log n version, the main one being
> that it only requires an 'Eq' constraint, not an 'Ord' one.

This is only an advantage for a tiny minority of types that have Eq
but no Ord instances, such as TypRep. But there's no good reason
why even this cannot have an Ord instance AFAICS (though not a derived
one obviously).

> another
> being that it is fully lazy, it produces results even for an infinite
> list.

As does the O(n*(log n)) AVL based nub I just wrote.

> a third is that the results come out in the order they went in.

As does the O(n*(log n)) AVL based nub I just wrote :-)

Regards
--
Adrian Hey



More information about the Libraries mailing list