[Haskell-cafe] cost of modules
fmohamed at mac.com
Tue Mar 27 17:10:21 EDT 2007
I decided to cleanup my program by splitting it in different modules.
As I was curious about
the cost of splitting it, or dually the efficiency of the intermodule
optimization I timed it before and after the split.
These are the results (ghc-6.6.20070129 on Linux AMD64):
Original: 3 Modules with the computational one with an export list
Variant 1: split computational module in 6 submodules without export
list, kept computational module reexporting the stuff with an export list
Variant 2: like Variant 1 but removing the old computational module (no
reexport list) 134%
All the functions in my modules have type specialized signatures, so
non-specialization should almost never be an issue.
The module with the Main function was not the exported one.
So 20% speed hit, I had hoped for 0, but it is not unbearable (even if
my code has to be as fast as possible, this was a very short run),
probably I will keep it split to have cleaner code.
Not I will have to write an export list for each module a see it the
things improve, and how much.
If someone has an idea on how else I can improve timings please tell me.
More information about the Haskell-Cafe