All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: git@vger.kernel.org,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 5/7] t0027: cache expected output files
Date: Tue, 10 Nov 2026 07:53:18 +0100	[thread overview]
Message-ID: <avK_XnoZ7Asakg25@pks.im> (raw)
In-Reply-To: <20261109144651.GA14738@tb-raspi4>

On Mon, Nov 09, 2026 at 03:46:51PM +0100, Torsten Bögershausen wrote:
> On Mon, Nov 09, 2026 at 10:58:26AM +0100, Patrick Steinhardt wrote:
> > In the preceding commit we have optimized one aspect of t0027 already.
> > Another inefficiency is `compare_files ()` and `compare_ws_file ()`,
> > which are both called more than a 1000 times.
> > 
> > These functions will repeatedly generate the same expected outcome even
> > though there's only a small handful of input files that the expected
> > outcome is computed from. Recomputing those every time is of course
> > quite pointless.
> > 
> > Improve this by computing the expected outcome once, only, to reduce the
> > number of spawned processes. This reduces the runtime by around 20-25%,
> > and on Windows the runtime decreases from 480 to 380 seconds.
> > 
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> >  t/t0027-auto-crlf.sh | 17 +++++++++--------
> >  1 file changed, 9 insertions(+), 8 deletions(-)
> > 
> > diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh
> > index 504a7ea54bb..b021f0855a8 100755
> > --- a/t/t0027-auto-crlf.sh
> > +++ b/t/t0027-auto-crlf.sh
> > @@ -5,22 +5,23 @@ test_description='CRLF conversion all combinations'
> >  . ./test-lib.sh
> >  
> >  compare_files () {
> > -	tr '\015\000' QN <"$1" >"$1".expect &&
> > +	{ test -f "$1".expect || tr '\015\000' QN <"$1" >"$1".expect; } &&
> >  	tr '\015\000' QN <"$2" | tr -d 'Z' >"$2".actual &&
> > -	test_cmp "$1".expect "$2".actual &&
> > -	rm "$1".expect "$2".actual
> > +	test_cmp "$1".expect "$2".actual
> >  }
> >  
> 
> Nice.
> If you want to save even more CPU/SSD-cycles,
> you can prepare the expect files like this:
> (No, I didn't do any benchmarks, nor look at ws_compare)

Thanks! I benchmarked this and it doesn't seem to make much of a
difference. So I'd propose to stick with the simple change for now, if
that's alright with you.

Patrick

  reply	other threads:[~2026-11-10  6:53 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 10:30 [PATCH 0/7] ci: some speedups for slow tests Patrick Steinhardt
2026-11-06 10:30 ` [PATCH 1/7] gitlab-ci: speed up installation of Git for Windows SDK Patrick Steinhardt
2026-11-06 17:20   ` Junio C Hamano
2026-11-09  6:58     ` Patrick Steinhardt
2026-11-06 10:30 ` [PATCH 2/7] gitlab-ci: exclude intermediate outputs from Windows artifacts Patrick Steinhardt
2026-11-06 10:30 ` [PATCH 3/7] ci: build optimized binaries with Meson Patrick Steinhardt
2026-11-06 17:24   ` Junio C Hamano
2026-11-06 10:30 ` [PATCH 4/7] t0027: optimize how we reset repository state Patrick Steinhardt
2026-11-06 17:33   ` Junio C Hamano
2026-11-08 16:49     ` Torsten Bögershausen
2026-11-09  6:30       ` Patrick Steinhardt
2026-11-06 10:30 ` [PATCH 5/7] t0027: cache expected output files Patrick Steinhardt
2026-11-06 10:30 ` [PATCH 6/7] t1092: set up repositories from templates Patrick Steinhardt
2026-11-06 10:30 ` [PATCH 7/7] t5551: use reftables for repositories with many refs Patrick Steinhardt
2026-11-06 17:39 ` [PATCH 0/7] ci: some speedups for slow tests Junio C Hamano
2026-11-09  9:58 ` [PATCH v2 " Patrick Steinhardt
2026-11-09  9:58   ` [PATCH v2 1/7] gitlab-ci: speed up installation of Git for Windows SDK Patrick Steinhardt
2026-11-09 16:53     ` Junio C Hamano
2026-11-10  6:53       ` Patrick Steinhardt
2026-11-10 16:11         ` Junio C Hamano
2026-11-09  9:58   ` [PATCH v2 2/7] gitlab-ci: exclude intermediate outputs from Windows artifacts Patrick Steinhardt
2026-11-09  9:58   ` [PATCH v2 3/7] ci: build optimized binaries with Meson Patrick Steinhardt
2026-11-09  9:58   ` [PATCH v2 4/7] t0027: optimize how we reset repository state Patrick Steinhardt
2026-11-09 16:59     ` Junio C Hamano
2026-11-10  6:53       ` Patrick Steinhardt
2026-11-09  9:58   ` [PATCH v2 5/7] t0027: cache expected output files Patrick Steinhardt
2026-11-09 14:46     ` Torsten Bögershausen
2026-11-10  6:53       ` Patrick Steinhardt [this message]
2026-11-10 10:29         ` Torsten Bögershausen
2026-11-09  9:58   ` [PATCH v2 6/7] t1092: set up repositories from templates Patrick Steinhardt
2026-11-09  9:58   ` [PATCH v2 7/7] t5551: use reftables for repositories with many refs Patrick Steinhardt
2026-11-12  8:19   ` [PATCH v2 0/7] ci: some speedups for slow tests Johannes Sixt
2026-11-11 10:47 ` [PATCH v3 " Patrick Steinhardt
2026-11-11 10:47   ` [PATCH v3 1/7] gitlab-ci: speed up installation of Git for Windows SDK Patrick Steinhardt
2026-11-11 10:47   ` [PATCH v3 2/7] gitlab-ci: exclude intermediate outputs from Windows artifacts Patrick Steinhardt
2026-11-11 10:47   ` [PATCH v3 3/7] ci: build optimized binaries with Meson Patrick Steinhardt
2026-11-11 10:47   ` [PATCH v3 4/7] t0027: optimize how we reset repository state Patrick Steinhardt
2026-11-11 10:47   ` [PATCH v3 5/7] t0027: cache expected output files Patrick Steinhardt
2026-11-11 10:47   ` [PATCH v3 6/7] t1092: set up repositories from templates Patrick Steinhardt
2026-11-11 10:47   ` [PATCH v3 7/7] t5551: use reftables for repositories with many refs Patrick Steinhardt

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=avK_XnoZ7Asakg25@pks.im \
    --to=ps@pks.im \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=tboegi@web.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.