Use of Array vs. BindingList vs Queue in data acquisition system

  • Thread starter Thread starter Eitan
  • Start date Start date
E

Eitan

Hello,

I have defined a real time data acquisition point as:

public class DataAcqPoint
{
public byte DataSrc;
public long TimeStamp;
public float Value;
}


I would like to get some opinion of what would be the most efficient, fast
way to store the data points as they come. The number of data points can
reach in excess of 10,000. I get them in a rate of few points per second.

Thanks
EitanB
 
I'll assume you are using .Net 2.0.

Some possibilities are List<DataAcqPoint> and Queue<DataAcqPoint>.
The choice depends on what you'll need to do with the data. IIRC
Queues let you get & remove the first item more efficiently than a
List, but don't give very good random access to the data.

You could also consider List<DataAcqPoint[]> or
List<ArraySegment<DataAcqPoint>>. If your data arrives in bunches,
one of these might be a more efficient way to store the data. This
may be less efficient when it comes to doing something with the data,
however.

If you're using 1.0/1.1, then you could write your own
DataAcqPointList class which manages an array.

You also need to decide if DataAcqPoint will be a struct or a class.
In general using classes is almost always recommended, however this
may be a case where a struct is appropriate (small # fields, lots of
instances). If you do make it a struct, be sure to understand the
implications of this decision.

With the caveat that I don't know your application requirements, my
recommendation would be to make DataAcqPoint a struct and use
List<DataAcqPoint>.
 
Hi Eitan,

Other than what JS suggested, 10,000 is really nothing, I did a little test
on my cheese laptop and created a list with List<TimeSpan> with 10,000 items
and it filled it up on a blink of an eye.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top