[Haskell-cafe] cost of modules

Fawzi Mohamed fmohamed at mac.com
Thu Mar 29 11:01:05 EDT 2007


Jules Bean wrote:
> Fawzi Mohamed wrote:
>> good to know, and very important when benchmarking various algorithms:
>> commenting out a variant is better as having it as separate function....
>
> Yes, but don't get over-paranoid. The 'overhead' of calling as opposed 
> to inlining is relatively small, and only matters if the function 
> concerned is being called many many times in your inner loop.
>
> Jules
Yes, but when benchmarking numerical algorithms you probably have such a
situation, my code went from 6.5 s to 8.0 s, without touching it, just
adding extra functions.
This was not something I had expected, and now, thanks to Simon's
comment I understand it.

I still wonder if some "common expression elimination" did not  kick in,
well I guess In the future I should really take a look to the Core
output, as Don suggested, but I am still trying to avoid it :-)...

Fawzi



More information about the Haskell-Cafe mailing list