exchange_and_add inlined in g++ 4.0.2
Peter Dimov
pdimov@mmltd.net
Mon Nov 7 13:17:00 GMT 2005
Paolo Carlini wrote:
> A bit of additional info, in case you missed some of yesterday
> messages. Given the cost of a function call on P4 (~10 cycles) vs
> that of an atomic (~ 500-1000 cycles) it's unlikely that your profile
> would change much if the atomics are inlined.
Some configurations may suffer a 1000 cycles penalty (quad Xeons would be my
guess - I've never observed that), but the average case isn't _that_ bad. On
my Athlon I'm seeing the following numbers:
lock xadd, inline: 12 seconds
lock xadd, out of line: 15 seconds
non-atomic add, inline: 2 seconds
non-atomic add, out of line: 7 seconds
for 2^30 operations on a totally non-representative looping benchmark. :-)
More information about the Libstdc++
mailing list