Pow very slow on x86_64
Wed Jan 28 16:46:00 GMT 2009
On Tue, 2009-01-27 at 07:33 -0800, philippe marguinaud wrote:
> Hi all,
> I have some trouble with pow on x86_64. Computing x^r with x close to 1. and r = 0.25 takes ages. The problem does not occur when compiling with -m32 and on x86. Here comes a piece of code:
A quick check of the code would be reveal what's going on but I got the
following email from Paul Murphy about this:
"I am pretty sure most of the libm functions for 32 bit are hand coded
in assembly. The x87 instruction set makes it very simple to code pow. I
am pretty sure x86_64 uses the generic implementation in libm.
The 32 bit code is probably much, much more predictable and stable in
the amount of time it takes to execute on a given input."
Ryan S. Arnold
More information about the Libc-help