Minor change to list comprehension structure leads to poor performance
According to http://stackoverflow.com/questions/24690406/haskell-list-comprehension-speed-inconsistencies and my own testing, the code in compspeed.hs reliably runs several times faster than the code in compspeedslow.hs with ghc 7.8.3. It seems 7.8.3 is compiling the "fast" code better than 7.6.3 did, but compiling the "slow" code about the same. The basic distinction is between a list comprehension of the form
[(a,h) | ..., let h = expr]
and
[(a,expr) | ...]
The core produced by -ddump-simpl is completely different in each case, so I can't figure out what's going on.
Edited by David Feuer