Re: Optimizing Enormous lists in NSBrowser
Re: Optimizing Enormous lists in NSBrowser
- Subject: Re: Optimizing Enormous lists in NSBrowser
- From: Jean-Francois Dontigny <email@hidden>
- Date: Mon, 21 Sep 2009 11:56:19 -0400
- Thread-topic: Optimizing Enormous lists in NSBrowser
Hi,
I don't know how helpful to you this could be, but you might want to take a
look at:
http://developer.apple.com/mac/library/documentation/Performance/Conceptual/
FileSystem/FileSystem.html#//apple_ref/doc/uid/10000161
You might be able to salvage something from the samples there.
JFD
On 9/17/09 5:32 PM, "Dave DeLong" <email@hidden> wrote:
> Hi everyone,
>
> I'm recreating a Finder-like column view fro browsing the disk, and
> I've come up against some optimization impasses.
>
> First off, I'm using passive-loading, so that I only load information
> regarding an item once I get the browser:willDisplayCell: message.
> This works wonderfully for lazy loading.
>
> My problem lies before that. I'm trying to mimic the Finder, so I
> want to not show hidden files if they're not visible in Finder. When
> I obtain a directory listing via NSFileManager, it includes everything
> (including hidden files). Once I get that listing, I filter it based
> with an "isFileVisible = YES" predicate, which calls an -[NSString
> isFileVisible] method I've implemented in a category. This method
> checks the three standard ways of hiding a file to determine its
> visibility (prefixed with ".", a flipped invisible bit, or listing it
> in /.hidden [which is deprecated, but I need to support older systems]).
>
> Once I've filtered the array, I sort it using a custom
> "compareLikeFinder:" method, which sorts items into the same order as
> they appear in Finder.
>
> For normal-sized directories, this works pretty well. However, in my
> "worst-case" scenario of a flat directory containing 1 million files,
> I've found that it takes 34.8 seconds to retrieve a full directory
> listing (so I know how many to return in
> browser:numberOfRowsInColumn:), 301.5 seconds to filter the array, and
> another 73.6 seconds to sort it.
>
> Believe it or not, this is actually better than the current
> implementation, but I'd like to do even better. On that note, here
> are my questions:
>
> 1. How can I obtain a count of files in a directory without
> retrieving the actual listing of contents? (I can scan through the
> folder and count by just grabbing catalog infos myself, but is there a
> faster way?)
> 2. How can I retrieve the name of the nth item in a directory without
> retrieving the actual listing of contents?
>
> Thanks!
>
> Dave DeLong
> _______________________________________________
>
> 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:
> alpoint.com
>
> This email sent to email@hidden
>
>
> ***********************************************************************
>
> This e-mail and its attachments are confidential, legally privileged, may be
> subject to copyright and sent solely for the attention of the addressee(s).
> Any unauthorized use or disclosure is prohibited. Statements and opinions
> expressed in this e-mail may not represent those of Radialpoint.
>
> Le contenu de ce courriel est confidentiel, privil�gi� et peut �tre soumis �
> des droits d'auteur. Il est envoy� � l'intention exclusive de son ou de ses
> destinataires. Il est interdit de l'utiliser ou de le divulguer sans
> autorisation. Les opinions exprim�es dans le pr�sent courriel peuvent diverger
> de celles de Radialpoint.
***********************************************************************
This e-mail and its attachments are confidential, legally privileged, may be subject to copyright and sent solely for the attention of the addressee(s).
Any unauthorized use or disclosure is prohibited. Statements and opinions expressed in this e-mail may not represent those of Radialpoint.
Le contenu de ce courriel est confidentiel, privilégié et peut être soumis à des droits d'auteur. Il est envoyé à l'intention exclusive de son ou de ses
destinataires. Il est interdit de l'utiliser ou de le divulguer sans autorisation. Les opinions exprimées dans le présent courriel peuvent diverger de celles de Radialpoint.
_______________________________________________
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