From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "D. Ben Knoble" <ben.knoble@gmail.com>, Git <git@vger.kernel.org>
Subject: Re: git-diff in a worktree is an order of magnitude slower?
Date: Mon, 22 Jun 2026 05:20:34 -0700 [thread overview]
Message-ID: <xmqqik7a4vhp.fsf@gitster.g> (raw)
In-Reply-To: <20260621212805.GB2297179@coredump.intra.peff.net> (Jeff King's message of "Sun, 21 Jun 2026 17:28:05 -0400")
Jeff King <peff@peff.net> 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.
next prev parent reply other threads:[~2026-06-22 12:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 23:36 git-diff in a worktree is an order of magnitude slower? D. Ben Knoble
2026-06-09 0:11 ` Jeff King
2026-06-09 17:15 ` D. Ben Knoble
2026-06-11 8:55 ` Jeff King
2026-06-11 17:43 ` Junio C Hamano
2026-06-11 21:06 ` brian m. carlson
2026-06-20 15:57 ` D. Ben Knoble
2026-06-21 0:53 ` Junio C Hamano
2026-06-21 3:58 ` Junio C Hamano
2026-06-21 17:24 ` Jeff King
2026-06-21 17:45 ` Jeff King
2026-06-21 20:24 ` Junio C Hamano
2026-06-21 21:28 ` Jeff King
2026-06-21 23:17 ` Junio C Hamano
2026-06-22 12:20 ` Junio C Hamano [this message]
2026-06-21 21:39 ` Junio C Hamano
2026-06-21 22:00 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqik7a4vhp.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox