Transitive inlining

Simon Peyton-Jones simonpj@microsoft.com
Mon, 18 Dec 2000 02:24:16 -0800


Yes, all the inlining you expect should indeed happen. If
it doesn't can you show us an example?

Simon

| -----Original Message-----
| From: Manuel M. T. Chakravarty [mailto:chak@cse.unsw.edu.au]
| Sent: 11 December 2000 13:41
| To: glasgow-haskell-users@haskell.org
| Cc: keller@it.uts.edu.au
| Subject: Transitive inlining
| 
| 
| In the context of the array library, we stumbled over
| another problem.  Does GHC transitive inlining across
| modules?  Let's say, we have the following scenario:
| 
|   module B (foo) where
| 
|   {-# INLINE foo #-}
|   foo .. = ...bar...
| 
|   {-# INLINE bar #-}
|   bar .. = ...
| 
| 
|   module L (baz) where
| 
|   import B
| 
|   {#- INLINE baz #-}
|   baz .. = ...B.foo...
| 
| 
|   module Main where
| 
|   import L
| 
|   main .. = ...L.baz...
| 
| GHC in this case inlines the whole expression "...B.foo..."
| in `Main', but will it inline the right hand side of `B.bar'
| in `Main' (or even of `B.foo')?  If the INLINE pragma is
| transitive across modules boundaries, one would hope so.
| 
| It seems that GHC is not (always?) doing this inlining,
| which already for a very simple benchmark costs us a factor
| of 5 runtime!  (With inlining - enforced by copying
| definitions manually into `Main' - the code produced by GHC
| is actually a little bit faster than the code for the
| corresponding C program).
| 
| Cheers,
| Manuel
| 
| PS: I had problems building GHCi and it seems as if my
|     message to cvs-ghc@haskell.org doesn't get through
|     somehow...
| 
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
|