Cost of Overloading vs. HOFs
duncan.coutts at worc.ox.ac.uk
Fri May 4 16:19:25 EDT 2007
On Fri, 2007-05-04 at 19:28 +0100, Adrian Hey wrote:
> The GHC users guide says overloading "is death to performance if
> left to linger in an inner loop" and one thing I noticed while
> playing about with the AVL lib was that using a HOF and passing
> the (overloaded) compare function as an explicit argument at the
> start seemed to give noticable a performance boost (compared with
> dictionary passing presumably).
> I'm not sure why that should be, but has anyone else noticed this?
One might hope that in this case we could hoist the extraction of the
dictionary members outside the inner loop.
More information about the Glasgow-haskell-users