[cfe-dev] FileManager re-factor

John Kelley jekelley at apple.com
Sun Dec 7 18:46:08 PST 2008


On Dec 7, 2008, at 6:27 PM, steve naroff wrote:

>> 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.

I think so as well, I'll circle back to this one after the others are  
done.

>> 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.

I am currently using dtrace to track the number of stats performed by  
clang. I am sampling clang's 'make test' right now to get numbers but  
am wondering if there is a large-ish clang-friendly project that would  
be better suited for this task? Recommendations welcome.

dtrace command line:
	dtrace -n 'syscall::stat:entry /execname == "clang"/  
{ @[copyinstr(arg0)] = count() }' > trace-clang-stat.log

I will probably write a small bash script to start the above in the  
background, run make and then kill the above to write out the log. I'm  
currently unaware of a way to have dtrace execute a command to trace  
and then exit on its own but I'm new to dtrace so it probably just  
haven't fount it yet.

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

No problem, it's my getting to learn clang project.

  - John



More information about the cfe-dev mailing list