3 ms·
This is what I meant, yes. Note that you incur the cost on immutable data structures as well as mutable ones. You really trash your caches this way.
by wingo 17y ago
This is what I meant, yes. Note that you incur the cost on immutable data structures as well as mutable ones. You really trash your caches this way.
- haberman 17y agoYou only pay a cost in cache if there is contention over a cache line. If there is no cache-line contention, I do not believe there is any overhead to atomic increment. See: http://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/59268/reply/59046/ http://software.intel.com/en-us/forums/intel-threading-build...
- haberman 17y agoAnd yet empirically there is a 20-40% slowdown: http://mail.python.org/pipermail/python-ideas/2009-November/006599.html http://mail.python.org/pipermail/python-ideas/2009-November/... The message is not too specific; is this on an SMP machine? Are these multi-threaded tests? Given the previous message I cited, I would expect the single-CPU, single-threaded case to be unaffected by making incref and decref atomic.