NSTableView performance issues
NSTableView performance issues
- Subject: NSTableView performance issues
- From: Stefan Arentz <email@hidden>
- Date: Sun, 27 May 2001 21:14:46 +0200
I'm trying to get the best performance out of a NSTableView which can
contain a lot of data in the worst case.
As a simple test I've added some NSLog()s in the data source and I
noticed the following:
The numberOfRowsInTableView method is called 48 times on a table with
6 columns and 3 rows. This results in at least 96 method calls as my
numberOfRowsInTableView calls NSArray count.
This looks like a bug because the data did not change. I think
the NSTableView should be smart enough to remember the row count
until I call reloadData, right? (Yes, I can cache the count in
my numberOfRowsInTableView, but that's a workaround, not a fix :)
Second issue is objectValueForTableColumn. I now look at the column
identifier, do a string comparison and then get the data which
corresponds with that row from an object stored in an array. So to
do a full 'setup' of one row with 6 columns, the NSTableView has to
do 6+5+4+3+2+1 = times a NSString.isEqualToString which is not
really great for performance I guess...
NSTableViewColumn only supports real objects as the identifier.
Can this also be a NSNumber? Does that indeed speed things up? I
prefer to do a simple lookup of an integer value, which is much
faster. Should I subclass NSTableViewColumn?
Help :-)
Stefan