[GHC] #9798: Frustrating behaviour of the INLINE pragma
GHC
ghc-devs at haskell.org
Thu Nov 13 07:47:33 UTC 2014
#9798: Frustrating behaviour of the INLINE pragma
-------------------------------------+-------------------------------------
Reporter: mojojojo | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.3
Keywords: | Operating System: MacOS X
Architecture: x86_64 (amd64) | Type of failure: Runtime
Difficulty: Unknown | performance bug
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
So I have a function "a", which uses another function "b" from another
module.
* Step 1. I benchmark its performance and get 250ns.
* Step 2. I go and put the "INLINE" pragma on the function "b", run the
benchmark again and get 500ns. That is twice as long.
* Step 3. I go and add an explicit invocation of the
[http://hackage.haskell.org/package/base-4.7.0.1/docs/GHC-
Exts.html#v:inline inline] function over function "b" in function "a" and
finally get the desired optimization: 208ns.
You can reproduce the issue by executing {{{cabal bench decoding
--benchmark-options=numeric}}} after cloning the trees of the following
commits:
* [https://github.com/nikita-volkov/postgresql-
binary/commit/31e08b4f6887445c28118d25f9da808e7ca9fc86 Step 1]
* [https://github.com/nikita-volkov/postgresql-
binary/commit/8f29b8daebc3161dc0fa35fbd70d3f3305370a4e Step 2]
* [https://github.com/nikita-volkov/postgresql-
binary/commit/3d3e4378bcd8ea85cda868d6a4bf07a76a9cad2c Step 3]
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9798>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list