From 904c17f77e0caeb25f736440d5727e0d89cfdf44 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Fri, 20 Jun 2025 12:03:57 -0400 Subject: [PATCH 1/3] Pass --warmup along to pyperf --- pyperformance/cli.py | 2 ++ pyperformance/run.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/pyperformance/cli.py b/pyperformance/cli.py index df68dc3d..80cbc24d 100644 --- a/pyperformance/cli.py +++ b/pyperformance/cli.py @@ -101,6 +101,8 @@ def parse_args(): choices=hook_names, metavar=f"{', '.join(x for x in hook_names if not x.startswith('_'))}", help="Apply the given pyperf hook(s) when running each benchmark") + cmd.add_argument("--warmups", + help="number of skipped values per run used to warmup the benchmark") filter_opts(cmd) # show diff --git a/pyperformance/run.py b/pyperformance/run.py index a9f9a102..4ee4253d 100644 --- a/pyperformance/run.py +++ b/pyperformance/run.py @@ -247,5 +247,7 @@ def get_pyperf_opts(options): if options.hook: for hook in options.hook: opts.append('--hook=%s' % hook) + if options.warmup: + opts.append('--warmup=%s' % options.warmup) return opts From 7536c54375a19bd3119d672d6954247e6a77b074 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Fri, 20 Jun 2025 12:22:28 -0400 Subject: [PATCH 2/3] Fixes --- pyperformance/cli.py | 2 +- pyperformance/run.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyperformance/cli.py b/pyperformance/cli.py index 80cbc24d..d8822726 100644 --- a/pyperformance/cli.py +++ b/pyperformance/cli.py @@ -101,7 +101,7 @@ def parse_args(): choices=hook_names, metavar=f"{', '.join(x for x in hook_names if not x.startswith('_'))}", help="Apply the given pyperf hook(s) when running each benchmark") - cmd.add_argument("--warmups", + cmd.add_argument("--warmups", type=int, default=None, help="number of skipped values per run used to warmup the benchmark") filter_opts(cmd) diff --git a/pyperformance/run.py b/pyperformance/run.py index 4ee4253d..209b937e 100644 --- a/pyperformance/run.py +++ b/pyperformance/run.py @@ -247,7 +247,7 @@ def get_pyperf_opts(options): if options.hook: for hook in options.hook: opts.append('--hook=%s' % hook) - if options.warmup: - opts.append('--warmup=%s' % options.warmup) + if options.warmups is not None: + opts.append('--warmups=%s' % options.warmups) return opts From cd5523fd318bc583843d62afa7389db1b2ec67a6 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 23 Jun 2025 08:50:15 -0400 Subject: [PATCH 3/3] Add comment about --warmups 0 --- pyperformance/run.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyperformance/run.py b/pyperformance/run.py index 209b937e..b535f96a 100644 --- a/pyperformance/run.py +++ b/pyperformance/run.py @@ -247,6 +247,7 @@ def get_pyperf_opts(options): if options.hook: for hook in options.hook: opts.append('--hook=%s' % hook) + # --warmups=0 is a valid option, so check for `not None` here if options.warmups is not None: opts.append('--warmups=%s' % options.warmups)