
30 Apr
2010
30 Apr
'10
4:44 p.m.
Edouard A. wrote:
Actually you will only add problems if you do that. You need to use a concurrent container, not a classical containers with atomics variables.
If you do nothing but mutate the stored objects, then it should be fine without a concurrent container.
First, atomic is more expensive than you think, to convince yourself of this, benchmark the two following codes:
int i = 0; while(i < 10 * 1000 * 1000) ++i;
Will probably be optimized to nothing, so it's not really a good example.