Apple releases CFTypes as an OpenSource - and they are the main data types for object-oriented collections like NSArray, NSDictionary, ... ("Infinite Bridging")
So, if we look at CFArray.c , we just see by looking at the include #include "CFStorage.h"
. This should be the type that hurts the data for real.
ok, looking at CFStorage.h , we find it in its comment
CFStorage uses a balanced tree to store values ββand is suitable for situations where a potentially large number of values ββ(more than a hundred bytes) will be saved and there will be a lot of editing (insert and delete).
Getting the O (log n) element, although caching the last result often reduces this by a constant time.
ergo
The name "NS (Mutable) Array" does not describe how it is implemented, but how it works at a higher level. And the implementation is much more complicated than just a list that would imply an array.
note
We do not know if an apple changes CFTypes when entering a closed source, so not everything can be explained by looking at the sources of CFTypes.
some numbers and charts: http://ridiculousfish.com/blog/posts/array.html
source share