[Haskell-cafe] cost of modules

Tim Chevalier catamorphism at gmail.com
Tue Mar 27 22:06:45 EDT 2007

On 3/27/07, Fawzi Mohamed <fmohamed at mac.com> wrote:
> I did longer runs (all compiled with -O2 as before) with the same
> results.
> and indeed with a couple of {-# INLINE function #-} I was able to
> recover the previous performance and actually even get a better
> performace than before.

If you had time to come up with a small test case that shows
significantly better performance with the {-# INLINE #-} pragmas, I'm
guessing that people on the glasgow-haskell-users mailing list might
be interested in seeing it. (Of course, inlining is a black art, so
it's also possible that with your example, you'll always know better
than the compiler does.)

> Thanks!
> An interesting thing is that the profiler actully was saying that the
> non inlined version (and for the matter also the the split version)
> were faster than the inlined or single module versions.
> It would seem that the profiling ovehead for the inlined functions
> are not correctly accounted for, so that they appear as more
> expensive than the plain version when profiling.

Profiling and optimization interact in ways that can result in
profiling information being misleading, optimizations being
effectively disabled, or both -- but, the overall numbers for time and
space usage should always be accurate regardless of inlining or other
optimizations, AFAIK. If you can explain what's happening in more
detail (i.e., by showing the profiler output in the different cases),
that might also be a topic for a ghc-users post.


Tim Chevalier * chevalier at alum.wellesley.edu * Often in error, never in doubt
Confused? See http://catamorphism.org/transition.html

More information about the Haskell-Cafe mailing list