[Haskell-cafe] vector stream fusion, inlining and compilation time

Don Stewart dons at galois.com
Thu Mar 4 13:20:16 EST 2010

> hi,
> two questions in one post:
> i've been hunting down some performance problems in DSP code using vector and
> the single most important transformation seems to be throwing in INLINE pragmas
> for any function that uses vector combinators and is to be called from
> higher-level code. failing to do so seems to prevent vector operations from
> being fused and results in big performance hits (the good news is that the
> optimized code is quite competitive). does anybody have some more info about the
> do's and don'ts when programming with vector?

Always inline any combination of things that are expressed in terms of
vector combinators, so that the combination of your code can hope to
fuse as well.

> the downside after adding the INLINE pragmas is that now some of my modules take
> _really_ long to compile (up to a couple of minutes); any ideas where i can
> start looking to bring the compilation times down again?

I'm not sure there's much we can do there.

> i'm compiling with -O2 -funbox-strict-fields instead of -Odph (with ghc 6.10.4
> on OSX 10.4), because it's faster for some of my code, but -O2 vs. -Odph doesn't
> make a noticable difference in compilation time.

-Odph should make it easier for some things to fuse -- and get better
code. But Roman can say more.

-- Don

More information about the Haskell-Cafe mailing list