[cfe-dev] FileManager re-factor

Chris Lattner clattner at apple.com
Tue Dec 23 15:12:10 PST 2008


On Dec 23, 2008, at 3:08 PM, Daniel Dunbar wrote:

> Interesting stuff... how did we live without these tools? :)
>
> On Tue, Dec 23, 2008 at 2:56 PM, Chris Lattner <clattner at apple.com>  
> wrote:
>> 2. We end up "checking" some directories many times.  For example,
>> Cocoa.h checks /Users/sabre/llvm/Debug/Headers/ 82 times for files in
>> my example, and only succeeds 5 times.  It would be better to have
>> DirectoryEntry get the file/dir contents of the directory after some
>> number of queries using 'getdirentries'.  This would save the  
>> repeated
>> negative hits to a directory.
>
> I'm a little paranoid about this, as this tradeoff could have a very
> bad worst case, and it makes performance less predictable across
> machines. However, for directories we expect to "control", like our
> own headers directory, it would make sense to just provide a mechanism
> to load the entire directory. Then we could investigate extending this
> assumptions to directories we expect to have a controlled structure
> (like frameworks).
>
> Dynamically making this choice seems like asking for a bugzilla when
> someone decides to drop their 6 headers into a directory with 10k
> files.

getdirentries takes a "max number of bytes to read".  If you call it  
once and it overflows a reasonable size, just consider the directory  
"too big to handle" and always stat future queries to it.

-Chris




More information about the cfe-dev mailing list