troubleshooting Question

Dictionary and array of [N] size - performance tuned

Avatar of websss
websssFlag for Kenya asked on
C#ASP.NET
12 Comments1 Solution130 ViewsLast Modified:
Hi All

I have a temperature reading device.
I require to store the last N records of its temperature reading in an object
it will either be 5, 10 or 20 records

I was thinking of a dictionary with ID and array:
it should look like this:

ID, array of [N] records

i.e. in this example, there are 2 ID's and I store the last 5 temperature values

12345, 10.01
             10.02
             11.05
             11.02
             11.20

42133, 11.01
             12.02
             12.05
             12.02
             12.20

My first question is about the array ordering
Can i define the size of the array, and push to it so it always inserts the latest temperature at top, and discards the oldest record at bottom, always keeping the correct size and order? (if not what other object should i use)

second question, is there a better way to do this, maybe using a different object??
I will be reading and updating it once a second so it needs to be FAST as there could be a million ID's each with 5-20 temperature readings
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros