- 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?
- How does it works in core?
Assume we have very big NSDictionary , when we want to call the objectForKey
Share
The CFDictionary section of the Collections Programming Topics for Core Foundation (which you should look into if you want to know more) states:
This is what wikipedia has to say about hash tables:
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: