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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to