[GHC] #7206: Implement cheap build
GHC
ghc-devs at haskell.org
Tue Feb 20 09:02:18 UTC 2018
#7206: Implement cheap build
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: simonpj
Type: bug | Status: new
Priority: normal | Milestone: ⊥
Component: Compiler | Version: 7.4.2
Resolution: | Keywords: FloatOut
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: #8763, #13422 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by osa1):
I rebased the `cheap-build` branch, applied the idea in #13422 to `Word`
and `Char` enumerations (`Int` was already implemented), verified that it
works as expected, and run nofib again. The result is the same; only
allocation difference is in `cacheprof`. Runtimes differ, but when I
compared STG outputs I see that they're identical even though runtime
differs a few percent. So they're really just noise. I suspect runtime
results in comment:13 are also of this nature.
I was thinking that this optimization can be done with little user
intervention by adding an `INLINE` pragma, but surprisingly it doesn't
work. In the example from #13422:
{{{
foo :: Int -> Int
foo n = s + p
where
nums = [1..n]
s = sum nums
p = product nums
}}}
adding `INLINE` to nums (in original GHC, without `cheap-build` patch)
does not make it fuse. However if I manually inline it (substitute
`[1..n]` for `nums`) it fuses as expected. Not sure if this is a bug or
not, but it's certainly surprising to me.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7206#comment:24>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list