# HG changeset patch # User Pierre-Yves David # Date 1686017345 -7200 # Node ID b8de54ac5a21f317b305578e4a1e0dbabc82e658 # Parent 28620be88da97290f38e7226a8ae643d885587d1 perf: add a perf::stream-generate command This record the time we take to generate a bundle. diff -r 28620be88da9 -r b8de54ac5a21 contrib/perf.py --- a/contrib/perf.py Mon Jun 12 18:04:09 2023 +0200 +++ b/contrib/perf.py Tue Jun 06 04:09:05 2023 +0200 @@ -1992,6 +1992,38 @@ fm.end() +@command( + b'perf::stream-generate', + [ + ( + b'', + b'stream-version', + b'latest', + b'stream version to us ("v1", "v2" or "latest", (the default))', + ), + ] + + formatteropts, +) +def perf_stream_clone_generate(ui, repo, stream_version, **opts): + """benchmark the full generation of a stream clone""" + + opts = _byteskwargs(opts) + timer, fm = gettimer(ui, opts) + + # deletion of the generator may trigger some cleanup that we do not want to + # measure + + generate = _find_stream_generator(stream_version) + + def runone(): + # the lock is held for the duration the initialisation + for chunk in generate(repo): + pass + + timer(runone, title=b"generate") + fm.end() + + @command(b'perf::parents|perfparents', formatteropts) def perfparents(ui, repo, **opts): """benchmark the time necessary to fetch one changeset's parents. diff -r 28620be88da9 -r b8de54ac5a21 tests/test-contrib-perf.t --- a/tests/test-contrib-perf.t Mon Jun 12 18:04:09 2023 +0200 +++ b/tests/test-contrib-perf.t Tue Jun 06 04:09:05 2023 +0200 @@ -188,6 +188,8 @@ perf::startup (no help text available) perf::status benchmark the performance of a single status call + perf::stream-generate + benchmark the full generation of a stream clone perf::stream-locked-section benchmark the initial, repo-locked, section of a stream-clone perf::tags (no help text available)