CFMutableDictionary Capacity
CFMutableDictionary Capacity
- Subject: CFMutableDictionary Capacity
- From: Andreas Grosam <email@hidden>
- Date: Wed, 20 Jul 2011 23:34:52 +0200
Is it possible to set the initial capacity (preparing for an initial number of key-value pairs) of a CFMutableDictionary?
According the doc, the parameter "capacity" in function CFDictionaryCreateMutable() sets the *maximum number* of key-value pairs which can be inserted into the container. That is, it's not an *initial* capacity.
When profiling, the code spends a lot of time in re-hashing. In my application, this would be completely unnecessary, since I know a priory the number of elements which I want to store in the dictionary. When setting the parameter "capacity" in CFDictionaryCreateMutable() it seems, it has no effect on re-hashing.
Using a NSMutableDictionary works differently here: initWithCapacity: seems to be set the initial size, and it performs much better in this case. So, since these containers are toll-free bridged, I would assume that there should be some similar function for CFMutableDictionary.
Thanks for tips :)
Regards
Andreas
_______________________________________________
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