From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff Hostetler <git@jeffhostetler.com>,
Taylor Blau <me@ttaylorr.com>,
Jeff Hostetler via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org, Jeff Hostetler <jeffhost@microsoft.com>
Subject: Re: [PATCH] t/perf/perf-lib.sh: remove test_times.* at the end test_perf_()
Date: Fri, 8 Oct 2021 15:57:10 -0400 [thread overview]
Message-ID: <YWCilnNa2eAakoX0@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqee8vl90e.fsf@gitster.g>
On Fri, Oct 08, 2021 at 10:30:09AM -0700, Junio C Hamano wrote:
> > There are cases it doesn't help, though. For instance, in one of the
> > scripts we measure the time to run "git repack -adb" to generate
> > bitmaps. But the first run has to do more work, because we can reuse
> > results for subsequent ones! It would help to "rm -f
> > objects/pack/*.bitmap", but even that's not entirely fair, as it will be
> > repacking from a single pack, versus whatever state we started with.
>
> You need a "do this too for each iteration but do not time it", i.e.
>
> test_perf 'repack performance' --prepare '
> make a messy original repository
> ' --per-iteration-prepare '
> prepare a test repository from the messy original
> ' --time-this-part-only '
> git repack -adb
> '
>
> Syntactically, eh, Yuck.
If any step doesn't need to be per-iteration, you can do it in a
separate test_expect_success block. So --prepare would always be
per-iteration, I think.
The tricky thing I meant to highlight in that example is that the
preparation step is non-obvious, since the timed command actually throws
away the original state. But we can probably stash away what we need.
With the test_perf_prepare I showed earlier, maybe:
test_expect_success 'stash original state' '
cp -al objects objects.orig
'
test_perf_prepare 'set up original state' '
rm -rf objects &&
cp -al objects.orig objects
'
test_perf 'repack' '
git repack -adb
'
which is not too bad. Of course it is made a lot easier by my use of the
unportable "cp -l", but you get the general idea. ;) This is all a rough
sketch anyway, and not something I plan on working on anytime soon.
For Jeff's case, the preparation would hopefully just be some sequence
of reset/read-tree/etc to manipulate the index and working tree to the
original state.
-Peff
next prev parent reply other threads:[~2021-10-08 19:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 22:29 [PATCH] t/perf/perf-lib.sh: remove test_times.* at the end test_perf_() Jeff Hostetler via GitGitGadget
2021-10-05 17:45 ` Taylor Blau
2021-10-06 19:24 ` Jeff King
2021-10-06 19:26 ` Taylor Blau
2021-10-07 17:49 ` Jeff Hostetler
2021-10-08 2:55 ` Jeff King
2021-10-08 7:47 ` A hard dependency on "hyperfine" for t/perf Ævar Arnfjörð Bjarmason
2021-10-08 17:30 ` [PATCH] t/perf/perf-lib.sh: remove test_times.* at the end test_perf_() Junio C Hamano
2021-10-08 19:57 ` Jeff King [this message]
2021-10-10 21:26 ` SZEDER Gábor
2021-10-13 21:09 ` Jeff Hostetler
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YWCilnNa2eAakoX0@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@jeffhostetler.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=jeffhost@microsoft.com \
--cc=me@ttaylorr.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).