[Haskell-cafe] cost of modules
Donald Bruce Stewart
dons at cse.unsw.edu.au
Tue Mar 27 18:04:25 EDT 2007
jeremy.shaw:
> At Tue, 27 Mar 2007 23:10:21 +0200,
> Fawzi Mohamed wrote:
>
> > If someone has an idea on how else I can improve timings please tell me.
>
> I believe you are seeing a speed decrease, because GHC is not inlining
> functions as much when you split them into modules. If you add
> explicit inline statements, I think you should be able to get back to
> your original timings.
>
> Below is an example of how to add INLINE statements.
>
> someFunction :: (Word8 -> Maybe Word8 -> Bool) -> B.ByteString -> B.ByteString
> someFunction = ...
> {-# INLINE someFunction #-}
>
> I am not sure what the downsides are. It probably makes the resulting
> binary bigger, and takes longer to compile. Though, probably not any
> worse than if you just put everything in one module?
>
> It might be the case that you only need to INLINE one or two functions
> to get most of the speed back.
>
Yes, INLINE and compile with -O2.
-- Don
More information about the Haskell-Cafe
mailing list