Library-vs-local performance

Scott Dillard sedillard at
Tue Jun 24 16:56:55 EDT 2008

> That said, it's entirely possible to program libraries in a way to
> specifically allow full inlining of the libraries. The Data.Binary and
> Data.Array.Vector libraries are written in this style for example,
> which means lots of {-# INLINE #-} pragmas, maximum unfolding and high
> optimisation levels.
> -- Don

Every function has an inline pragma. Adding -O2 -funfolding-use-threshold999
-funfolding-creation-threshold999 does not significantly change the produced
.hi files (--show-iface produces roughly the same files, just different
headers)  This makes sense to me because the library doesn't actually _do_
anything. There are no significant compiled functions, everything should be
inlined. And since the .hi files are the same, I don't see why they wouldn't
be. The two scenarios are these:

1) Library is installed via cabal.
2) Library source lives in the same directory as the application, so that
ghc --make Examples.hs also builds the library.

When compiling the application I set all knobs to 11. In case 1, ./Examples
3000000 runs in 6.9s, case 2 in 5.2s. The module structure is the same in
both cases, so I don't know what inlining across module boundaries has to do
with it.

By the way, the library is now on hackage,
but the documentation does not show up. What do I have to do to make this

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Glasgow-haskell-users mailing list