Ignore:
Timestamp:
Jun 5, 2008, 2:16:33 AM (14 years ago)
Author:
livings124
Message:

minor efficiency improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentTableView.m

    r5935 r6044  
    189189    else
    190190    {
    191         if ([[tableColumn identifier] isEqualToString: @"UL Image"] || [[tableColumn identifier] isEqualToString: @"DL Image"])
     191        NSString * ident = [tableColumn identifier];
     192        if ([ident isEqualToString: @"UL Image"] || [ident isEqualToString: @"DL Image"])
    192193        {
    193194            //ensure arrows are white only when selected
     
    455456            for (i = 0; i < [self numberOfRows]; i++)
    456457            {
     458                if ([indexSet containsIndex: i])
     459                    continue;
     460               
    457461                id tableItem = [self itemAtRow: i];
    458462                if (![tableItem isKindOfClass: [Torrent class]] && [group isEqualToNumber: [tableItem objectForKey: @"Group"]])
     
    483487{
    484488    NSIndexSet * selectedIndexes = [self selectedRowIndexes];
    485     NSMutableArray * torrents = [NSMutableArray array];
     489    NSMutableArray * torrents = [NSMutableArray arrayWithCapacity: [selectedIndexes count]]; //take a shot at guessing capacity
    486490   
    487491    NSUInteger i;
     
    490494        id item = [self itemAtRow: i];
    491495        if ([item isKindOfClass: [Torrent class]])
    492         {
    493             if (![torrents containsObject: item])
    494                 [torrents addObject: item];
    495         }
     496            [torrents addObject: item];
    496497        else
    497             [torrents addObjectsFromArray: [item objectForKey: @"Torrents"]];
     498        {
     499            NSArray * groupTorrents = [item objectForKey: @"Torrents"];
     500            [torrents addObjectsFromArray: groupTorrents];
     501            i += [groupTorrents count];
     502        }
    498503    }
    499504   
Note: See TracChangeset for help on using the changeset viewer.