

Fast NSDictionary traversal in Objective-C - terhechte
http://appventure.me/2011/12/fast-nsdictionary-traversal-in-objective-c.html

======
mayoff
Another approach:

    
    
        @interface NSDictionary (objectForKeyList)
        - (id)objectForKeyList:(id)key, ...;
        @end
    
        @implementation NSDictionary (objectForKeyList)
    
        - (id)objectForKeyList:(id)key, ...
        {
            id object = self;
            va_list ap;
            va_start(ap, key);
            for ( ; key; key = va_arg(ap, id))
                object = [object objectForKey:key];
            va_end(ap);
            return object;
        }
    
        @end

~~~
terhechte
Also a good idea, thanks for sharing. This could even be expanded to check
whether list items are integers and call objectAtIndex: instead in order to
traverse Array/Dictionary mixups.

------
jcizzle
Eh. Not really seeing it.

I think the category approach is much better (cleaner, easier documented,
conventional) and there really isn't a speed increase in using the
preprocessor (anything that looks like a difference in time is due to either
caching or CPU load at the time).

