[GHC] #9326: Minor change to list comprehension structure leads to poor performance

#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 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: -------------------------------------+------------------------------------- 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9326 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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

#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: | -------------------------------------+------------------------------------- Changes (by jstolarek): * cc: jan.stolarek@… (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9326#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Changes (by slyfox): * cc: slyfox (added) Comment: In 'comdspeed' one more rule did fire (to specialze .find on Ints): {{{ "SPEC find [(Int, Int)]" [ALWAYS] forall @ a3_a2Tz $dOrd_s2U0. find $dOrd_s2U0 = $sfind }}}. It's seen in core comparison when use '''-ddump-simp -dsuppress-all'''. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9326#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9326: Minor change to list comprehension structure leads to poor performance -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: invalid | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: Runtime | Blocked By: performance bug | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by dfeuer): * status: new => closed * resolution: => invalid Comment: It looks like the original reporter was able to resolve the problem by adding some type signatures to get things specialized earlier. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9326#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC