RE: how to break up a large module?

I recently spent a couple of hours breaking up a large module (2.5k lines) into several smaller modules. When I finally got it working, I found that my program took about 60% longer to run. This was running ghc with -O optimization.
Any suggestions how to go about breaking up a module in such a way that it doesn't slow things down? Do I just have to go adding INLINE directives to all my functions? Or is there some other trick I could use?
Be careful about accidental overloading: GHC will specialise if it can see the uses of a function within a single module, but not when the function is in another module. Put type signatures on everything, and consider using SPECIALISE pragmas to eliminate overloading. Be careful with exports. Prune export lists to just those functions which need to be exported. Cheers, Simon

Simon Marlow wrote:
Be careful about accidental overloading: ...
Be careful with exports. Prune export lists to just those functions which need to be exported.
How a too long export list can slow-down the target program? Jerzy Karczmarczuk
participants (2)
-
Jerzy Karczmarczuk
-
Simon Marlow