Thanks for the code snippet Mark!
Back on the discussion of -countByEnumerationWithState I wanted to add some thoughts on the following verbiage:
Some additional subtle observations ... The enumeration is fast because of the given array of pointers. This comes into play when you implement the scanning pointers.
All incrementing is done through pointer arithmetic which is suppose to be provide better performance. Initially I just appreciated having the "scratch workspace" but now I realize the importance of using the array of pointers in addition to the unsigned long * extra data resource. The two in tandem are a powerful combination.
As you have mentioned there is a lot that under the hood in the implementation of Apple Frameworks that we don't know about. But I have a hunch under the hood this type of implementation might be used in a lot of places that might not be apparent...
I hope my pointer performance observation is the right hunch...