3 ms·
Uncontended interlocked operation is typically about 100-300 CPU cycles. Uncontended mutex is about 30x-50x that. If there is contention, multiply everything b
by pkolaczk 13y ago
Uncontended interlocked operation is typically about 100-300 CPU cycles. Uncontended mutex is about 30x-50x that. If
there is contention, multiply everything by another 100x.
Additionally these instructions impact not only the calling thread but also other threads by forcing cache synchronization.
Therefore a relatively simple operation like pointer assignment can be one cycle when using GC and a hundred to several thousands cycles when using refcounting. Sometimes you can ignore this overhead, sometimes not - depends on how often you do that.
http://software.intel.com/en-us/articles/choosing-between-synchronization-primitives http://software.intel.com/en-us/articles/choosing-between-sy...
- Ono-Sendai 13y agoOn what CPU? on my i7s it's much faster. on the order of 50 cycles for a uncontended mutex lock and release i think. I can dig out the values if anyone cares.