Optimise CPArrayController insertObject:atArrangedObjectIndex: by not attempting to arrange the content array. The given index is only meant for the arrangedObjects.

This commit is contained in:
Alexander Ljungberg
2011-06-02 23:41:03 -04:00
parent 0a9c9741e8
commit 5d01ca428c
2 changed files with 7 additions and 2 deletions
+6 -2
View File
@@ -771,7 +771,8 @@
}
/*!
Adds an object at a given index to the receiver's collection.
Adds an object at a given index in the receiver's arrangedObjects. Also add the object
to the content collection (although at the end rather than the given index).
@param id anObject - The object to add to the collection.
@param int anIndex - The index to insert the object at.
@@ -790,7 +791,10 @@
See _disableSetContent explanation in addObject:.
*/
_disableSetContent = YES;
[_contentObject insertObject:anObject atIndex:anIndex];
// The atArrangedObjectIndex: part of this method's name only refers to where the
// object goes in arrangedObjects, not in the content array. So use addObject:,
// not insertObject:atIndex: here for speed.
[_contentObject addObject:anObject];
_disableSetContent = NO;
if (_clearsFilterPredicateOnInsertion)