[llvm-commits] CVS: llvm/lib/System/Unix/MappedFile.inc

Chris Lattner clattner at apple.com
Fri Mar 30 09:45:12 PDT 2007


On Mar 30, 2007, at 7:49 AM, Jeff Cohen wrote:

> Chris Lattner wrote:
>>> Use the stat information in the Path object, if it is already   
>>> obtained. This
>>> avoids a call to ::fstat by MappedFile when the file size   
>>> information was
>>> already obtained by the Path object.
>>>
>>
>> Interesting approach.  The problem is that fstat is significantly   
>> faster than stat.  How about a new Path::getFileStatusFromFD()   
>> method, which takes an open file descriptor.  If the System  
>> supports  it, it can get status information faster by using it,  
>> otherwise it  falls back to getFileStatus (e.g. if win32 doesn't  
>> have fstat)?
>>
>> -Chris
>>
>
> It does, but names it _fstat.  I'm not sure it's worth the bother  
> to cache fstat either.  stat is slow because it has to look up the  
> file path.

fstat is slow because it's a syscall, meaning you have to cross the  
userspace/kernel boundary.

-Chris



More information about the llvm-commits mailing list