mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-26 21:47:04 +00:00
Faster CPMutableArray removeObjectIdenticalTo:.
About 6-8X speedup by skipping all the `indexOfObjectIdenticalTo:` calls and going straight to JS `indexOf`.
This commit is contained in:
@@ -246,6 +246,21 @@ var concat = Array.prototype.concat,
|
||||
splice.call(self, anIndex, 1);
|
||||
}
|
||||
|
||||
- (void)removeObjectIdenticalTo:(id)anObject
|
||||
{
|
||||
var anIndex = indexOf.call(self, anObject);
|
||||
if (anIndex !== -1)
|
||||
splice.call(self, anIndex, 1);
|
||||
}
|
||||
|
||||
- (void)removeObjectIdenticalTo:(id)anObject inRange:(CPRange)aRange
|
||||
{
|
||||
if (!aRange)
|
||||
[self removeObjectIdenticalTo:anObject];
|
||||
|
||||
[super removeObjectIdenticalTo:anObject inRange:aRange];
|
||||
}
|
||||
|
||||
- (void)addObject:(id)anObject
|
||||
{
|
||||
push.call(self, anObject);
|
||||
|
||||
Reference in New Issue
Block a user