[cfe-dev] FileManager re-factor

steve naroff snaroff at apple.com
Sun Dec 7 18:27:36 PST 2008


On Dec 7, 2008, at 9:11 PM, John Kelley wrote:

> I've been looking at how FileManager is used in clang to figure out
> how best to use llvm::sys::PathWithStatus to replace large parts of
> FileEntry and it seems possibly all of DirectoryEntry.
>
> I was hoping that I could get rid of the (per-file) directory stat by
> assuming that if the file existed, so does the directory but then I
> saw that we use the directory device and inode on unix-like systems as
> an index in UniqueDirContainer. Is the stat more expensive then
> hitting an llvm::StringMap to see if we've checked this exact
> directory yet?

I would imagine stat() is much more expensive.

> We seem to use the device/inode combo to account for
> sym-linked directories but we don't seem to try to resolve the
> symlinked directory to it's origin so as to avoid the FS stat on open.
> Is this something that should be implemented instead?

Sounds good. It would be useful to measure the difference to verify  
the performance improvement.

>
>
> Also, the directory stat can be ifdef'd out for WIN32 as the WIN32
> implementation of UniqueDirContainer doesn't make use of any of the
> stat elements.
>
> I've already ben able to replace the path construction and parsing
> code in FileManager with calls to the appropriate Path member function
> which cleans things up nicely.
>
> Thoughts?
>

I don't believe FileManager has received much attention lately, so  
it's great to have you look into improving it.

I'm sure Chris will have some thoughts...

snaroff

> John
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list