[Haskell-cafe] GHC Optimization seriously hurting performance by unsharing.

Kim-Ee Yeoh ky3 at atamo.com
Wed Apr 9 05:11:41 UTC 2014

On Tue, Apr 8, 2014 at 12:55 PM, Michael Karcher <
mkarcher at mkarcher.dialup.fu-berlin.de> wrote:

> >  let bigset = fromAscList testdata
> finally query the membership of the number 5 several times. This happens
> to be reasonably fast if compiled without optimization, but goes down to
> dog slow if compiled with optimization, as the set building process is
> hoisted into the loop and thus performed 10 times.
> >  replicateM_ 10 . print . member 5 $ bigset

Isn't this 'hoisting into the loop' a case of over-aggressive inlining, a
known pitfall of -O2 ?

What happens with plain -O, which is the recommended general-purpose
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140409/cbe43778/attachment.html>

More information about the Haskell-Cafe mailing list