From: Junio C Hamano Date: Mon, 22 Jun 2026 12:20:34 GMT Subject: Re: git-diff in a worktree is an order of magnitude slower? Message-ID: In-Reply-To: <20260621212805.GB2297179@coredump.intra.peff.net> Jeff King writes: > Yes, though that implies comparing the index and file mtimes with > nanosecond precision. We have that precision stored (at least > when the system supports it) but I'm not sure if that comparison would > run afoul of the reasons USE_NSEC was not the default in the first > place. > > I guess not? The problem there is that the nanosecond portion would > sometimes get wiped if the entry was dropped from the kernel's in-memory > cache. And then stat-matching would not work. But if we are talking > about strictly asking "is this mtime later than that mtime", then I > think the worst case is that we fall back to the current behavior. Right, and you are right to point out that for the purpose of comparing mtimes of files' and the index file, this would make it unworkable. I can imagine that a file and the index may have been written within the same millisecond but we can tell that the former slightly earlier than the latter (or the other way around) with nanoseconds resolution, then only one of the two lose the sub millisecond resolution but not the other due to its in-core inode evicted out of the cache. Depending on which one survives (and keeps a non-zero sub millisecond part), they can compare differently.