Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyperformance/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", type=int, default=None,
help="number of skipped values per run used to warmup the benchmark")
filter_opts(cmd)

# show
Expand Down
3 changes: 3 additions & 0 deletions pyperformance/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,8 @@ 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if options.warmups is not None:
if options.warmups:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to be able to pass --warmups 0 explicitly when that is specified.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah got it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you leave the comment for it?

opts.append('--warmups=%s' % options.warmups)

return opts
Loading