Ignore:
Timestamp:
Jan 8, 2012, 5:05:12 PM (10 years ago)
Author:
livings124
Message:

improve how we search the message window's message array

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/MessageWindowController.m

    r13108 r13146  
    443443    NSString * filterString = [fFilterField stringValue];
    444444   
    445     NSMutableArray * tempMessages = [NSMutableArray arrayWithCapacity: [fMessages count]]; //rough guess
    446    
    447     for (NSDictionary * message in fMessages)
    448     {
    449         if ([[message objectForKey: @"Level"] integerValue] <= level
    450             && [self shouldIncludeMessageForFilter: filterString message: message])
    451             [tempMessages addObject: message];
    452     }
    453    
    454     [tempMessages sortUsingDescriptors: [fMessageTable sortDescriptors]];
     445    NSIndexSet * indexes = [fMessages indexesOfObjectsWithOptions: NSEnumerationConcurrent passingTest: ^BOOL(id message, NSUInteger idx, BOOL * stop) {
     446        return [[(NSDictionary *)message objectForKey: @"Level"] integerValue] <= level && [self shouldIncludeMessageForFilter: filterString message: message];
     447    }];
     448   
     449    NSArray * tempMessages = [[fMessages objectsAtIndexes: indexes] sortedArrayUsingDescriptors: [fMessageTable sortDescriptors]];
    455450   
    456451    const BOOL onLion = [NSApp isOnLionOrBetter];
Note: See TracChangeset for help on using the changeset viewer.