Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Avoiding stat calls (again)

On Sat, Nov 13, 2010 at 7:36 AM, Robin Rosenberg
<robin.rosenberg@xxxxxxxxxx> wrote:
> This issue pops up again and again, I guess when one stops being tired of it. I got an idea that does not involve JNI.
>
> If the time stamp hasn't changed, couldn't we assume size didn't change either? I believe
> all OS:es update the timestamp when we write to a file, not just on open/close.

This is probably true.  But we use length check when timestamp is same
to reduce the racy-git condition.  But we already have racy-git
checking going on so we might be able to drop the length check for the
pure Java variant.  (We still want to use JNI to get proper lstat(2)
for symlinks.)

> Given some definition of old, we could avoid retrieving the file size if the (old) timestamp
> in the index equals the one on disk when checking for a possible modification.

Yes.  Assuming the racy-git stuff within the index is working
properly, I think you are right.

> What would old be? 2 seconds (FAT) or much more?

Whatever is stored in the index.  We shouldn't be rounding off timestamps.

-- 
Shawn.


Back to the top