NSMutableDictionary Look Up
NSMutableDictionary Look Up
- Subject: NSMutableDictionary Look Up
- From: Dave <email@hidden>
- Date: Sat, 23 May 2015 15:27:51 +0100
HI All,
The App I am working on has a network of nodes, of which I need to monitor.
Each node has a Unique ID and this ID along with the Object representing the Node is stored in an NSMutableDictionary.
Here are the Statistics for the dictionary:
Invalid = 0;
KeyLengthAverage = "176.000000";
KeyLengthLongest = 186;
KeyLengthShortest = 7;
Total = 853;
Valid = 853;
Inactive = 668;
Active = 185;
This dictionary is built using real-life test data, but in the real world, the number Total number of entires is likely to be a factor of 5 greater (around 3500).
Out of the total of 853, in this case there are only 185 active nodes are which about the limit that I need to handle at anyone time. Nodes go Active and Inactive usually in groups. My app gets notifications when this happens and updates the dictionary Node Data.
Then other parts of the App look up the IDs in the dictionary and update the UI accordingly.
I was wondering about the speed of access on this given that the Average Key Size which is around 176 characters (the average size of the keys won’t change much when the live data is added) and the number of total number of entires is around 3500.
It occurred to me that I could just keep the active elements in a separate dictionary and then the total number of entries would be significantly smaller.
Do you think it’s worth making this optimization?
This is a Mac app, so memory isn’t so much of an issue.
All the Best
Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden