• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Table View Blues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: Table View Blues (From: <email@hidden>)

  • Prev by Date: Re: MAC Address of machine
  • Next by Date: Re: [OT] jobs?
  • Previous by thread: Re: Table View Blues
  • Next by thread: Re: Table View Blues
  • Index(es):
    • Date
    • Thread