|
Boost : |
From: David Abrahams (abrahams_at_[hidden])
Date: 2000-06-06 20:07:11
From: "John Maddock" <John_Maddock_at_[hidden]>
> Well here's the performance comparison from MSDN:
>
> Table 1. Comparison times when incrementing a counter.
>
> regular memory variable: 31.25 nanoseconds
> atomic counter: 178.1 nanoseconds
> critical section: 504.6 nanoseconds
>
>
> So an atomic increment is about 4x faster than a critical section.
AFAIK, the atomic counter you are referring to (I assume
InterlockedIncrement here) is a fairly heavyweight function call designed to
work on SMP systems, and not the simple one-instruction atomic
count-and-test which is available in almost all ISAs. One would expect the
latter to show a much greater improvement in speed.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk