[Haskell-cafe] [Somewhat OT] Speed

Richard O'Keefe ok at cs.otago.ac.nz
Thu Oct 30 00:49:51 EDT 2008


On 30 Oct 2008, at 9:22 am, Andrew Coppin wrote:
> I'm not really interested in getting down to instruction-level  
> scheduling. I just want to know, at a high level, will implementing  
> my algorithm in integer arithmetic rather than floating-point make a  
> measurable difference to overall program speed.

Sorry, but there is only one way to find out.
Take such an algorithm and try it.

It can even depend on your compiler switches.

Changing representations will affect more than time:
it will affect the _meaning_ of your code.

Integers: there is no round-off error at the least significant
end, but there can be "modulo error" (to coin a phrase) at the
most significant end, unless you use Integer.

> Actually, thinking about it, I suppose the killer question is this:  
> Does changing between different numer representations make any  
> measurable performance difference at all, or are Haskell programs  
> dominated by cache misses?

If you have code where it makes enough difference, you should
consider using a binding to something like Intel's libraries.
(Or possibly Sun's, or GSL, depending on what you fancy.)

Anything I might say about the version of GCC I have now
might not be true any longer for the next version to come out.



More information about the Haskell-Cafe mailing list