Re: Optimizing Enormous lists in NSBrowser
Re: Optimizing Enormous lists in NSBrowser
- Subject: Re: Optimizing Enormous lists in NSBrowser
- From: Jens Alfke <email@hidden>
- Date: Mon, 21 Sep 2009 09:27:50 -0700
On Sep 21, 2009, at 8:28 AM, Graham Cox wrote:
Ideally if the list can't display more than, say 50 files at a time
(depends on how big your screen is, etc), then it shouldn't touch
more than 50 files on disk. It has never really managed that
however, and maybe there are fundamental limitations in the file
system that prevent it optimising to that extent.
The biggest problem is sorting, I think. The Unix filesystem APIs
don't define any ordering for the items in a directory, so you have to
assume items will be returned in random order. Since your list is
presumably sorted, at least by name, that means you can't just read
the first 50 items from the directory's catalog and display them. You
have to read every entry so you can sort them all.
(In practice, the HFS+ filesystem does return filenames in
alphabetical order, although I think it's just sorted by Unicode
codepoint, which for non-ascii characters isn't going to be the
correct localized sort order. And you still have to be able to handle
other filesystems as found on memory cards and file servers...)
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden