
#9326: Minor change to list comprehension structure leads to poor performance -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Differential Revisions: | Operating System: Unknown/Multiple Architecture: | Type of failure: Runtime Unknown/Multiple | performance bug Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | -------------------------------------+------------------------------------- Description changed by dfeuer: Old description:
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, although this apparently does not happen with 7.6.3. 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.
New description: 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. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9326#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler