473,473 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

difference between sets

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?
Oct 25 '07 #1
4 1863
On 2007-10-25 21:23, Anonymous wrote:
I am writing a method that will send a message to another object, based
on changes (if any) bewtween two sets of data.
Who owns these two sets?
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.
Can you not just watch for changes to either of those sets?
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 ?
I am not sure in what manner you are planning on using the sets. If you
just want to compare two sets then there is nothing to worry about.
2). Is there a more elegant (and faster?) way of recognising if the
contents of a set has changed?
As I said earlier, watching for changes instead of checking for them
would be more efficient.

--
Erik Wikström
Oct 25 '07 #2
On Oct 26, 3:23 am, Anonymous <no.re...@here.comwrote:
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?
The scenario looks very much like what Observer design pattern should
be
applied to. You could try this out using Observer pattern.

Cheers,

Oct 26 '07 #3
hashing it or fingerprint it....

good luck.


Anonymous wrote:
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?
Oct 26 '07 #4
try fingerprinting the snapshot set and the live set, compare them
and ...

Oct 26 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mickel Grönroos | last post by:
Hi! Are there any standard list methods for getting the intersection and difference of two lists? (The union is easy ("list1.extend(list2)"), unless you want it to contain unique values.) ...
21
by: b83503104 | last post by:
Hi, Can someone tell me the difference between single quote and double quote? Thanks
0
by: Patrick | last post by:
I have built a smart client application. It will only run under the full trust permission set. It will fail if I give it unrestricted access under the everything permission set. What is the...
4
by: VB Programmer | last post by:
If I have a variable I want to share in my application what is the difference between just declaring a variable (Dim strMyVar as String) and using a session variable (Session("strMyVar"))? When...
8
by: Alan Silver | last post by:
Hello, ASP.NET newbie here so please be nice ;-) I'm reading ASP.NET Unleashed, following a recommendation here. I am a little confused about the difference between HTML controls and web...
10
by: Just Me | last post by:
Does Me.Cursor.Current=Cursors.WaitCursor set the current property of Me.Cursor to Cursors.WaitCursor And Me.Cursor.Current=Cursors.Default set the Me.Current property to something (default)...
8
by: arun | last post by:
Hi all,, I want to know if there is any performance difference between the following sets of declarations. int i, j; and int i;
10
by: ravi | last post by:
Hi, i am a c++ programmer, now i want to learn programming in c also. so can anybody explain me the difference b/w call by reference and call by pointer (with example if possible).
11
by: cmb3587 | last post by:
I have two arrays and I'm trying to create a 3rd array that is the difference between the two arrays Ex: arrayA: 3 5 8 9 arrayB: 3 4 6 9 difference of A-B: 5 8 however, my...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.