Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6799859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:53:56+00:00 2026-05-26T18:53:56+00:00

Assume we have very big NSDictionary , when we want to call the objectForKey

  • 0
  1. Assume we have very big NSDictionary, when we want to call the objectForKey method, will it make lots of operations in core to get value? Or will it point to value in the memory directly?
  2. How does it works in core?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:53:57+00:00Added an answer on May 26, 2026 at 6:53 pm

    The CFDictionary section of the Collections Programming Topics for Core Foundation (which you should look into if you want to know more) states:

    A dictionary—an object of the CFDictionary type—is a hashing-based
    collection whose keys for accessing its values are arbitrary,
    program-defined pieces of data (or pointers to data). Although the key
    is usually a string (or, in Core Foundation, a CFString object), it
    can be anything that can fit into the size of a pointer—an integer, a
    reference to a Core Foundation object, even a pointer to a data
    structure (unlikely as that might be).

    This is what wikipedia has to say about hash tables:

    Ideally, the hash function should map each possible key to a unique
    slot index, but this ideal is rarely achievable in practice (unless
    the hash keys are fixed; i.e. new entries are never added to the table
    after it is created). Instead, most hash table designs assume that
    hash collisions—different keys that map to the same hash value—will
    occur and must be accommodated in some way. In a well-dimensioned hash
    table, the average cost (number of instructions) for each lookup is
    independent of the number of elements stored in the table. Many hash
    table designs also allow arbitrary insertions and deletions of
    key-value pairs, at constant average (indeed, amortized) cost per
    operation.

    The performance therefore depends on the quality of the hash. If it is good then accessing elements should be an O(1) operation (i.e. not dependent on the number of elements).

    EDIT:

    In fact after reading further the Collections Programming Topics for Core Foundation, apple gives an answer to your question:

    The access time for a value in a CFDictionary object is guaranteed to
    be at worst O(log N) for any implementation, but is often O(1)
    (constant time). Insertion or deletion operations are typically in
    constant time as well, but are O(N*log N) in the worst cases. It is
    faster to access values through a key than accessing them directly.
    Dictionaries tend to use significantly more memory than an array with
    the same number of values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume I have an enumerable object enum and now I want to get the
Assume I have one threadpool and each thread is running following method: void runMe(HashMap
Let's assume you have a big complex index page, that shows news articles and
I have a big and bloated software and I want to add a new
Let's assume you have a very well designed Delphi project, which respects the dependency
Let's assume we have this very simple table: |class |student| --------------- Math Alice Math
Let's assume we have this very simple 'test' table. There is: 5 bob, 2
Let's assume that on a hard drive I have some very large data file
Assume I have two tables, Student Test Id Name TestId Type StudentId -- ----
Assume I have the following ; def test(): while 1: a = b time.sleep(60)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.