
#9246: GHC generates poor code for repeated uses of min/max --------------------------------------------+------------------------------ Reporter: arotenberg | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 Type of failure: Runtime performance bug | (amd64) Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: #6135 --------------------------------------------+------------------------------ Comment (by arotenberg): Having now read "A transformation based optimiser for Haskell", I learned about the `let-no-escape` optimization, which I was not previously aware of. Looking at the output of `-ddump-stg` on UglyBranching, all of the local lambdas are actually bound by `let-no-escape`, which makes the whole question irrelevant. Well, now I feel silly. I guess if there's something to be learned here, it's that `let-no-escape` could be publicized better! Everything I've seen on the internet up until now was all "look at the Core, if you see `let`, that's a Bad Thing and you might want to Do Something About It!" (Quoth the GHC docs: "If profiling has pointed the finger at particular functions, look at their Core code. lets are bad, cases are good, ... nested lambdas are bad, ...") -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9246#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler