• 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: NSTableView with large arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView with large arrays


  • Subject: Re: NSTableView with large arrays
  • From: Stephane Sudre <email@hidden>
  • Date: Tue, 8 Nov 2005 12:56:06 +0100


On 8 nov. 05, at 12:39, Trygve Inda wrote:


On 8 nov 2005, at 11.27, Trygve Inda wrote:

How should I handle it in Cocoa? In Carbon, all 10,000 records are
never in
memory at once, but all the Cocoa examples I have seen load up an
NSMutableArray with all the table data and use
objectAtIndex:rowIndex to
show it.

Does NSTableView cache data at all?

No, it only requests, and "caches", the visible rows.

How well will it perform with 10,000 rows?

It depends completely on your data source implementation. You can still make it lazy if you want to. 10.000 rows should be no problem at all.


So if I ask it to sort, how does this work?

In Carbon, I just detect the current sort column (A or B) and use the proper
index (since it is all presorted). I never let the DataBrowser do the actual
sorting.


In Cocoa can I do the same? ie when it asks for row 1, I can determine it
based on one of my two indexes, but don't let the NSTableView do any real
sorting.


What method does it use to sort if I just toss all 10,000 records into an
NSMutableArray?

NSTableView does not care how you arrange your data, sort it or load it. It just wants to know how many rows there are and the value for each row/column when it needs to display them.


In recent releases of the OS, some features were added to propose some kind of sorting facilities but the sort still is on your to-do list.

If you need to sort a NSMutableArray, then it's the NSMutableArray sort method which is going to be used, not NSTableView. It's probably a qsort.

BUT this does not prevent you from sorting your data by yourself. In one case, I have a plain C array which is _displayed_ by NSTableView but is sorted 2 ways: insertion sort and qsort. So that the sort used is always the more appropriate to the situation.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: NSTableView with large arrays (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: NSTableView with large arrays
  • Next by Date: mysterious memory leak in cocoa ?
  • Previous by thread: Re: NSTableView with large arrays
  • Next by thread: mysterious memory leak in cocoa ?
  • Index(es):
    • Date
    • Thread