A
Anonymous
I am writing a method that will send a message to another object, based
on changes (if any) bewtween two sets of data.
I anticipate that this method will be called about 50k-100k times - i.e.
it needs to check if there has been any change in a set of data a very
large number of times.
The way I am currently thinking of implementing this is to store a local
copy of the set, and then check for a difference between the local copy
and the newly received set - and then send the appropriate message based
on the difference.
Because of the large number of times this function will be executed - I
thuink it is likely to be a bottleneck - since I'm not too familiar with
std::set, I thought it best to ask in here for advice - i.e. :
1). Are there any gotchas I need to be aware of when using std::set in
the manner described above ?
2). Is there a more elegant (and faster?) way of recognising if the
contents of a set has changed?
on changes (if any) bewtween two sets of data.
I anticipate that this method will be called about 50k-100k times - i.e.
it needs to check if there has been any change in a set of data a very
large number of times.
The way I am currently thinking of implementing this is to store a local
copy of the set, and then check for a difference between the local copy
and the newly received set - and then send the appropriate message based
on the difference.
Because of the large number of times this function will be executed - I
thuink it is likely to be a bottleneck - since I'm not too familiar with
std::set, I thought it best to ask in here for advice - i.e. :
1). Are there any gotchas I need to be aware of when using std::set in
the manner described above ?
2). Is there a more elegant (and faster?) way of recognising if the
contents of a set has changed?