Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to improve NSTableView performance?
    primarykey
    data
    text
    <p>I am using a datasource and a delegate for the tableview. The responsive seems to be acceptable for 500-800 rows. Anything above 1500 rows the response time is about 7-10 seconds and the scrolling becomes choppy too.</p> <p>Just to give the broader context, there is a list of database tables. When one of these is selected, the table data is shown. So essentially I am dynamically removing and adding columns to the tableview. </p> <p>First I remove the columns after setting the delegate for the tableview to nil (otherwise the tableview will refresh and call the delegate). A database query is made after this asking for the column data. Then I add the columns based on the database query result: anywhere from two to thirty columns. After that [tableView reload] is called. The database results are in a NSMutableArray, which, in the delegate is set as NSArray. The column values are in NSDictionary.</p> <pre><code>-(NSView*)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { NSDictionary* rowData = [_tableData objectAtIndex:row]; NSString* identifier = [tableColumn identifier]; NSTableCellView* result = [tableView makeViewWithIdentifier:@"myCellView" owner:self]; if (result == nil) { //result = _myTableCellView; commented out because result would be nil without // an IBOutlet in the windowcontroller which is not the case now. NSLog(@"result in nil"); //[[result textField] setStringValue:[rowData objectForKey:identifier]]; } else { [[result textField] setStringValue:[rowData objectForKey:identifier]]; } // NSLog(@"result text field: %@", [[result textField] stringValue]); return result; } </code></pre> <p>I have run the code through Instrument's Timer profiler. It seems that 95% of the time is spend in "unarchiving" the view in makeViewWithIdentifier. The database access is extremely fast—it is a local postgres instance. So that is not a bottleneck. I wonder if I should start thinking about some form of paginating data in the table view. Any ideas? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload