Re: Table View Blues
Re: Table View Blues
- Subject: Re: Table View Blues
- From: Alex Rice <email@hidden>
- Date: Mon, 18 Nov 2002 12:14:17 -0700
On Monday, November 18, 2002, at 05:43 AM, <email@hidden>
wrote:
Yes, this is very cool, but it's not on the upside that the problem
occurs. We all know we have to get the data in there. What we cannot
afford is a haphazard memory arrangement so we're spending as much
time getting rid of it later.
Someone suggested to me off-list that NSTableView might not retain
objects it gets from the NSTableDataSource. If that's true then the
bottleneck is completely in the data source implementation and has
nothing to do really with the table view itself.
If your data has 1M rows, don't create 1M NSStrings when the data
source object is created, as the previous loadTableDataFromFile:
example would do. Instead create the NSStrings lazily.
The tableview will only request objects from the data source _when it
needs to display them_. The user can view at most 100 or so rows at
once, and there is no problem creating 100 NSStrings it won't even be a
noticable hit creating them every time the user scrolls. Actually only
1 NSString would be created each time your
tableView:objectValueForTableColumn:row: is called. Something like this:
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
NSString *answer = [NSString stringWithCString:
someReallyFastFnToReadCSVData( rowIndex, [aTableColumn identifier]
)];
return answer;
}
If you implement it this way I suspect your performance concerns will
disappear. I might try this later on because I am curious :-)
Alex Rice <email@hidden>
Mindlube Software
http://mindlube.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.