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
JS - 18 Mar 2008 17:46 GMT
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>.
Eitan - 18 Mar 2008 18:11 GMT
Hi,
Thanks for you answer.
EitanB
> I'll assume you are using .Net 2.0.
>
[quoted text clipped - 21 lines]
> recommendation would be to make DataAcqPoint a struct and use
> List<DataAcqPoint>.
Rene - 18 Mar 2008 22:37 GMT
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.
> Hello,
>
[quoted text clipped - 13 lines]
> Thanks
> EitanB