• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CFMutableDictionary Capacity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: CFMutableDictionary Capacity
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: [Q] Directory & File enumeration order?
  • Next by Date: Re: [Q] Directory & File enumeration order?
  • Previous by thread: Re: [Q] Directory & File enumeration order?
  • Next by thread: Re: CFMutableDictionary Capacity
  • Index(es):
    • Date
    • Thread