mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-09 10:20:59 +00:00
Marginally faster filter and sort in CPArrayController's arrangeObjects (4% in the performance tester.) Reduced memory usage when both a filter and a sort order are applied. Cleanup of the tester and a filter only test run.
This commit is contained in:
1 parent
998c2f19cf
commit
271bb00147
3 files changed
+51
-25
No files matched your search
@@ -197,14 +197,21 @@
|
||||
|
||||
- (CPArray)arrangeObjects:(CPArray)objects
|
||||
{
|
||||
var sortedObjects = objects;
|
||||
var filterPredicate = [self filterPredicate],
|
||||
sortDescriptors = [self sortDescriptors];
|
||||
|
||||
if ([self filterPredicate])
|
||||
sortedObjects = [sortedObjects filteredArrayUsingPredicate:[self filterPredicate]];
|
||||
if ([self sortDescriptors])
|
||||
sortedObjects = [sortedObjects sortedArrayUsingDescriptors:[self sortDescriptors]];
|
||||
if (filterPredicate && sortDescriptors)
|
||||
{
|
||||
var sortedObjects = [objects filteredArrayUsingPredicate:filterPredicate];
|
||||
[sortedObjects sortUsingDescriptors:sortDescriptors];
|
||||
return sortedObjects;
|
||||
}
|
||||
else if (filterPredicate)
|
||||
return [objects filteredArrayUsingPredicate:filterPredicate];
|
||||
else if (sortDescriptors)
|
||||
return [objects sortedArrayUsingDescriptors:sortDescriptors];
|
||||
|
||||
return sortedObjects;
|
||||
return [objects copy];
|
||||
}
|
||||
|
||||
- (void)rearrangeObjects
|
||||
|
||||
Reference in new issue
Block a user