One has now been filed, so you don't have to. In the abstract class, there's nothing to be done but call through the defined primitive methods. The only way to avoid the call to objectForKey: is for the concrete classes to each individually override and replace the abstract implementation with a custom implementation that replicates all the functionality with direct access to the storage of the collection objects. for(in) already has such an override for the concrete collection classes of Foundtion.
To add my emphasis on the for(in) vs enumerate.* question, to what already has been said: for(in) is going to be fastest, except specifically in the case of dictionaries where you need the value for the key sufficiently often or every iteration, and the concrete class you have an instance of doesn't override and replace the countBy.... NSFastEnumeration method with its own custom version. (I'm saying 'replace' here, by which I mean you can't call super and leverage inheritance.). Although newer, the enumerate.* methods are unlikely to be faster in most non-concurrent cases. What they bring to the table are more options, and method names that would never collide with any method anyone would actually ever put [in a category] on the collection classes.
On Sep 6, 2012, at 4:54, Mike Abdullah <email@hidden> wrote:
> On 5 Sep 2012, at 20:43, Greg Parker <email@hidden> wrote:
>> On Sep 5, 2012, at 10:36 AM, Bill Garrison <email@hidden> wrote:
>>> Mike Abdullah wrote a blog post on this recently, in the context of enumerating dictionaries:
>>> tl;dr: fast enumeration of dictionary keys FTW
>> Did anyone file a bug report? Ordinary NSDictionaries shouldn't be calling -objectForKey: in -enumerateKeysAndObjectsUsingBlock: .
> I didn't file a bug report, because the end behaviour seemed fairly reasonable to me. Can if you'd like.
> Do not post admin requests to the list. They will be ignored.
> Objc-language mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> This email sent to email@hidden
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden