Re: Spinlock backoff algorithm - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Spinlock backoff algorithm
Date
Msg-id 20071116084542.GB31271@svana.org
Whole thread Raw
In response to Re: Spinlock backoff algorithm  (Josh Berkus <josh@agliodbs.com>)
Responses Off-Topic: Float point division academia? (was: Re: Spinlock backoff algorithm)  (Mark Mielke <mark@mark.mielke.cc>)
List pgsql-hackers
On Wed, Nov 14, 2007 at 06:57:18PM -0800, Josh Berkus wrote:
> The question is, for our most common platforms (like AMD and Intel) is the FPU
> notably slower/more contended than integer division?  I'd the impression that
> it was, but my knowledge of chip architectures is liable to be out of date.
>
> Can we have a hardware geek speak up?

I did some searching and the best figures I can find for integer
division is 15-40 cycles whereas for floating point the best I found was 5
cycles. The FP units on modern processer as very highly optimsed, but
the figures quoted are for pipelined division, which is not what we're
doing here.

http://www.behardware.com/art/imprimer/623/

I did find a thread about how integer division on the Itanium was
implemented by copying the integers to the FP registers, doing the
division and rounding there and copying back. So at least there it's
not true.

http://gcc.gnu.org/ml/gcc-patches/2005-12/msg01518.html

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy

pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: [COMMITTERS] pgsql: update files for beta3
Next
From: Andreas Joseph Krogh
Date:
Subject: Re: Javascript support in the backend, i.e. PL/JS