I'm doing some brute-force computing and putting the results into a set all_data
. Computing chunks of data gives a list of numbers new_data
, which I want to add to the big set: all_data.update(new_data)
. Now while the computational part is easily made parallel by means of multiprocessing.Pool.map
, the update part is slow.
Obviously, there is a problem if one has two identical elements in new_data
, that are absent in all_data
, and trying to add them at the same moment. But if we assume new_data
to be a set as well, is there still a problem? The only problem I can see is the way sets are organized in memory, so the question is:
Is there a way to organize a set structure that allows simultaneous addition of elements? If yes, is it realized in Python?