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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to