Skip to content

Commit d920e6c

Browse files
authored
Add num iterations option to the perf_compare internal tool (#18275)
Sometimes we need more iterations to get precise results.
1 parent ac89577 commit d920e6c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

misc/perf_compare.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
Simple usage:
44
5-
python misc/perf_compare.py my-branch master ...
5+
python misc/perf_compare.py master my-branch ...
66
77
What this does:
88
@@ -78,10 +78,17 @@ def run_benchmark(compiled_dir: str, check_dir: str) -> float:
7878

7979
def main() -> None:
8080
parser = argparse.ArgumentParser()
81-
parser.add_argument("commit", nargs="+")
81+
parser.add_argument(
82+
"-n",
83+
metavar="NUM",
84+
default=15,
85+
type=int,
86+
help="number of measurements to perform (default=15)",
87+
)
88+
parser.add_argument("commit", nargs="+", help="git revision to measure (e.g. branch name)")
8289
args = parser.parse_args()
8390
commits = args.commit
84-
num_runs = 16
91+
num_runs: int = args.n + 1
8592

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

0 commit comments

Comments
 (0)