Re: [PATCH 1/2] t4205: compare huge output without diff
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Sep 28, 2026, 06:36 UTC
- Message-ID
- <aroK4d5GZ6VoFUim@pks.im>
- In-Reply-To
- <CAJ-ks9kJWc0e7aEX4vAL-RoJ5kVvfjDABqV86_hZf2Fn-085GA@mail.gmail.com>
On Thu, Sep 24, 2026 at 04:41:05PM -0400, Tamir Duberstein wrote:
Show 12 quoted lines
> On Thu, Sep 24, 2026 at 2:13 AM Patrick Steinhardt <ps@pks.im> wrote: > > > > On Wed, Sep 23, 2026 at 01:13:28PM -0400, Tamir Duberstein wrote: > > > The huge-commit test compares two files with a line larger than 2 GiB. > > > In Linux GitHub Actions jobs, git log produces its huge output but > > > its subsequent diff process is killed with SIGKILL. > > > > I've never seen that failure before. Do you maybe have a link to it? > > The failures happened on a private repo that I've since lost access to > - but I believe it was precipitated by GitHub runners having half the > memory in private repos as in public ones [1].
Okay.
Show 14 quoted lines
> > > Use test_cmp_bin to compare the output byte for byte without constructing > > > a line-oriented diff. Remove the two large files after a successful > > > comparison, releasing more than 4 GiB before subsequent tests. > > > > It would be great to back up the claim that test_cmp_bin is better than > > test_cmp, e.g. by comparing peak RSS and its runtime. > > As for the comparison: on Linux arm64 with GNU > diffutils 3.8 using two identical files containing 2,147,483,649 "1" bytes > followed by "0\n" (matching this test's expected output) gave: > > Command Mean +/- stddev Maximum RSS (KiB) > diff -u expect actual 5.276 +/- 0.572 s 4199924 > cmp expect actual 0.506 +/- 0.099 s 1264
Quite a significant win indeed.
Show 25 quoted lines
> > > Signed-off-by: Tamir Duberstein <tamird@gmail.com> > > > --- > > > t/t4205-log-pretty-formats.sh | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh > > > index 4be5c51489..6279a7e9bc 100755 > > > --- a/t/t4205-log-pretty-formats.sh > > > +++ b/t/t4205-log-pretty-formats.sh > > > @@ -1189,7 +1189,8 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'set up huge commit' ' > > > test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' ' > > > git log -1 --format="%B%<(1)%x30" $huge_commit >actual && > > > echo 0 >>expect && > > > - test_cmp expect actual > > > + test_cmp_bin expect actual && > > > + rm expect actual > > > ' > > > > Hm. Sure, releasing these files isn't a bad idea by itself. But we > > rewrite "expect" in the next test anyway, and "actual" will be rewritten > > two tests further down. So does it really buy us that much...? > > You're right, this probably does not buy much. > > Would you like me to include the performance comparison in v2?
I think that'd be good, yes. Providing context like this to the reviewer makes everyone's life easier :)
> As for the deletion: would you prefer I drop it?
My personal take is that we can just drop it as it doesn't buy us much. If we want to keep it we should be honest about its effect in the commit message.
Patrick