Skip to content

Commit

Permalink
Add num iterations option to the perf_compare internal tool (#18275)
Browse files Browse the repository at this point in the history
Sometimes we need more iterations to get precise results.
  • Loading branch information
JukkaL authored Dec 10, 2024
1 parent ac89577 commit d920e6c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions misc/perf_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Simple usage:
python misc/perf_compare.py my-branch master ...
python misc/perf_compare.py master my-branch ...
What this does:
Expand Down Expand Up @@ -78,10 +78,17 @@ def run_benchmark(compiled_dir: str, check_dir: str) -> float:

def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("commit", nargs="+")
parser.add_argument(
"-n",
metavar="NUM",
default=15,
type=int,
help="number of measurements to perform (default=15)",
)
parser.add_argument("commit", nargs="+", help="git revision to measure (e.g. branch name)")
args = parser.parse_args()
commits = args.commit
num_runs = 16
num_runs: int = args.n + 1

if not (os.path.isdir(".git") and os.path.isdir("mypyc")):
sys.exit("error: Run this the mypy repo root")
Expand Down

0 comments on commit d920e6c

Please sign in to comment.