Przeglądaj źródła

Improve network history table view performance when lots of network activity is occurring.

This was showing up hot in the profile. The documentation for -[UITableView reloadRowsAtIndexPaths:withRowAnimation:] actually suggests what we’re doing here now for cases where you don’t need to make updates obvious to the user.
Ryan Olson 11 lat temu
rodzic
commit
6f2d811338

+ 4 - 4
Classes/Network/FLEXNetworkHistoryTableViewController.m

@@ -229,10 +229,10 @@
     for (UITableView *tableView in tableViews) {
         for (FLEXNetworkTransactionTableViewCell *cell in [tableView visibleCells]) {
             if ([cell.transaction isEqual:transaction]) {
-                NSIndexPath *indexPath = [tableView indexPathForCell:cell];
-                if (indexPath) {
-                    [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
-                }
+                // Using -[UITableView reloadRowsAtIndexPaths:withRowAnimation:] is overkill here and kicks off a lot of
+                // work that can make the table view somewhat unresponseive when lots of updates are streaming in.
+                // We just need to tell the cell that it needs to re-layout.
+                [cell setNeedsLayout];
                 break;
             }
         }