Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eitan - 18 Mar 2008 17:05 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.