3 ms·
Yes, the DCLP can be done safely if you use atomic operations for the comparisons to 0. Sadly though, atomic operations are still quite expensive, depending on
by gilgoomesh 12y ago
Yes, the DCLP can be done safely if you use atomic operations for the comparisons to 0.
Sadly though, atomic operations are still quite expensive, depending on CPU, taking as much as 40-50 times as long as a basic comparison. But you gotta do what you gotta do.
- StephanTLavavej 12y agoYou need an atomic load, followed by an ordinary comparison. On x86 and x64, this is cheap (properly-aligned loads and stores are already atomic, and the architectures do very little reordering that has to be prevented). On ARM it's more expensive. You're probably thinking of things like atomic increments, which are one to two orders of magnitude more expensive than an ordinary increment.