Re: NSIndexSet
Re: NSIndexSet
- Subject: Re: NSIndexSet
- From: Jon Hull <email@hidden>
- Date: Sat, 29 Nov 2003 19:59:27 -0800
On Nov 29, 2003, at 6:30 PM, Matthew Johnson wrote:
I am implementing a category on NSIndexSet that includes a method -
(BOOL)intersectsIndexes:(NSIndexSet *)indexSet. The implementation of
this will have to loop through one of the index sets and check for
intersection using containsIndex and intersectsIndexesInRange. I am
wondering whether it would generally be quicker to loop through the
smaller index set or perform the intersection tests on the smaller
index set. Opinions?
Why not just use the methods firstIndex and lastIndex on the both sets
then use the larger firstIndex and smaller lastIndex to make an
NSRange, then return intersectsIndexesInRange?
OOPS, disregard that last message just looked at the docs more
carefully.
I would suggest only checking in the NSRange mentioned in my last
message, but beyond that I doubt that there is a huge speed difference.
Thanks,
Jon
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.