R
Rajat
Hi,
I am receiving objects in form of eventArguments through very frequent
events from some external source. Better to say that we need to handle the
flood of events, and process the object received from each event as soon as
possible and wait for the new events.
Right now I keep on adding the received objects in some Arraylist. I need to
use the saved objects for calculation as well as for displaying on UI. I
have used some of the following techniques to complete the job. Can I get
comments or comparison among the points given below for increasing the
performance. Any further improvements/suggestions are most welcome.
1) Use of the Generic List and Dictionary instead of ArrayList
2) Keep on adding the objects in an arraylist till a certain time limit
(lets say 250 ms) and then forward the ArrayList through event to UI/class
for display/calculation. Since shared arraylist acess can create
issues(for filling data from events and fetching data to send), so I can use
the following alernative methods ...
a) Create 2 Arraylists. Fill first arraylist till a certain time
limit, then set a bool variable and start filling alternate arraylist.
Using the first arraylist for sending event to own UI and
then clear this first arraylist. Next do same thing with alternate arraylist
b) Whenever a time limit elaspes, use lock to access a arraylist
and create clone. Use this clone for sending into the eventarg.
3) Firing so many events can bring down the system. So receive the data
in some event from external source and keep adding into arraylist. External
UI etc can fetch the data after certain interval by accessing a
property wrapped arround a cache.
Regards,
Rajat.
I am receiving objects in form of eventArguments through very frequent
events from some external source. Better to say that we need to handle the
flood of events, and process the object received from each event as soon as
possible and wait for the new events.
Right now I keep on adding the received objects in some Arraylist. I need to
use the saved objects for calculation as well as for displaying on UI. I
have used some of the following techniques to complete the job. Can I get
comments or comparison among the points given below for increasing the
performance. Any further improvements/suggestions are most welcome.
1) Use of the Generic List and Dictionary instead of ArrayList
2) Keep on adding the objects in an arraylist till a certain time limit
(lets say 250 ms) and then forward the ArrayList through event to UI/class
for display/calculation. Since shared arraylist acess can create
issues(for filling data from events and fetching data to send), so I can use
the following alernative methods ...
a) Create 2 Arraylists. Fill first arraylist till a certain time
limit, then set a bool variable and start filling alternate arraylist.
Using the first arraylist for sending event to own UI and
then clear this first arraylist. Next do same thing with alternate arraylist
b) Whenever a time limit elaspes, use lock to access a arraylist
and create clone. Use this clone for sending into the eventarg.
3) Firing so many events can bring down the system. So receive the data
in some event from external source and keep adding into arraylist. External
UI etc can fetch the data after certain interval by accessing a
property wrapped arround a cache.
Regards,
Rajat.