[GHC] #12847: ghci -fobject-code -O2 doesn't do the same optimisations as ghc --make -O2

#12847: ghci -fobject-code -O2 doesn't do the same optimisations as ghc --make -O2 -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Other Architecture: | Type of failure: Compile-time Unknown/Multiple | performance bug Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- From IRC: I have a module that takes around 10 seconds to compile on ghc --make -O2, but only around 3 seconds on ghci -fobject-code -O2.
bgamari: that is surprising
I've put the -v timing output of the two cases into https://gist.github.com/nh2/e9bc4732111bfe422d8e606c10f8f0ac I'm comparing the 2 files with `meld` for spotting differences easily. Check e.g. `Result size of Tidy Core` which seems to have 3x as many terms for ghc, and `Simplifier [Mymodule]` doesn't seem to run in ghci The first time terms are different is at `Desugar, the first time a factor 3 comes in is after `Specialize`.
bgamari: wow, it sounds like the simplifier isn't getting run as aggressively in GHCi
I'm running this on Ubuntu 16.04 inside nix (but happens the same way outside nix). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12847 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12847: ghci -fobject-code -O2 doesn't do the same optimisations as ghc --make -O2 -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Other | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): Although you don't say so explicitly, you seem to be invoking `ghci` and then running `:set -fforce-recomp -fobject-code -O2 -v` at the prompt. Does the same happen with `ghci -fforce-recomp -fobject-code -O2 -v`? This could be because of #9370, where decisions about whether to inline a function are effectively made when reading the interface file in which the function is defined; and at that point you may not have `-O2` set yet. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12847#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12847: ghci -fobject-code -O2 doesn't do the same optimisations as ghc --make -O2 -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Other | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nh2): Replying to [comment:1 rwbarton]:
you seem to be invoking `ghci` and then running `:set -fforce-recomp -fobject-code -O2 -v`
I am. Your guess seems right, if I start ghci on the command line with these flags, it's just as slow as ghc. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12847#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12847: ghci -fobject-code -O2 doesn't do the same optimisations as ghc --make -O2 -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: duplicate | Keywords: Operating System: Other | Architecture: Type of failure: Compile-time | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RolandSenn): * status: new => closed * resolution: => duplicate Comment: This is the same bug as in #13002. During startup without a -O flag on the command line, GHCi misses to store optimization data (like inline pragmas and rewrite rules). After a :set -O2 this optimization data is missing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12847#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC