git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t/perf/perf-lib.sh: remove test_times.* at the end test_perf_()

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 8, 2021, 17:30 UTC
Message-ID
<xmqqee8vl90e.fsf@gitster.g>
In-Reply-To
<YV+zFqi4VmBVJYex@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 31 quoted lines
> What I'd propose instead is that we ought to have:
>
>   test_perf 'checkout'
>             --prepare '
> 	        git reset --hard the_original_state
> 	    ' '
> 	        git checkout
> 	    '
>
> Having two multi-line snippets is a bit ugly (check out that awful
> middle line), but I think this could be added without breaking existing
> tests (they just wouldn't have a --prepare option).
>
> If that syntax is too horrendous, we could have:
>
>   # this saves the snippet in a variable internally, and runs
>   # it before each trial of the next test_perf(), after which
>   # it is discarded
>   test_perf_prepare '
>           git reset --hard the_original_state
>   '
>
>   test_perf 'checkout' '
>           git checkout
>   '
>
> I think that would be pretty easy to implement, and would solve the most
> common form of this problem. And there's plenty of prior art; just about
> every decent benchmarking system has a "do this before each trial"
> mechanism. Our t/perf suite (as you probably noticed) is rather more
> ad-hoc and less mature.
Nice.
Show 6 quoted lines
> 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.
Previous: Ævar Arnfjörð BjarmasonNext: Jeff King
Message 8 of 11 in “t/perf/perf-lib.sh: remove test_times.* at the end test_perf_()”
  1. t/perf/perf-lib.sh: remove test_times.* at the end test_perf_()Jeff Hostetler via GitGitGadget, Oct 4, 2021
  2. Taylor BlauOct 5, 2021
  3. Jeff KingOct 6, 2021
  4. Taylor BlauOct 6, 2021
  5. Jeff HostetlerOct 7, 2021
  6. Jeff KingOct 8, 2021
  7. A hard dependency on "hyperfine" for t/perfÆvar Arnfjörð Bjarmason, Oct 8, 2021
  8. Junio C HamanoOct 8, 2021
  9. Jeff KingOct 8, 2021
  10. SZEDER GáborOct 10, 2021
  11. Jeff HostetlerOct 13, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.