If I don’t care about mean/stddev/entries consistency.
I don’t think is safe because two updates of the same bin can happen at the same time and then the result might not be correct. I would create an histogram for each thread or lock when calling the AddBinContent function (but will kill all performances)
The sets of bins for each thread are not overlapping.
The playground for disaster is greater than the size of a bin content storage - it’s a cache line. But in practice we are aware of people doing what you say, and they survive But it’s risky, there’s no guarantee that the result is guaranteed to be correct. As Lorenzo said, you could use
I can random shuffle the bin numbers to the threads won’t content for a cache line.
is very slow.
TThreadedObject is much faster than locking a single histogram It’s all relative…
I don’t understand the random shuffle comment - but that’s not needed for it to work! Glad you have a solution!