Skip to content

Reduce the variability of the mypy benchmark #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 27, 2023
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: 1 addition & 1 deletion benchmarks/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gevent_hub <local>
gunicorn <local>
json <local>
kinto <local>
mypy <local>
mypy2 <local>
pycparser <local>
pylint <local>
pytorch_alexnet_inference <local>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "bm_mypy"
name = "bm_mypy2"
dependencies = [
"mypy",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ def _bench_mypy(loops=20, *, legacy=False):
times = []
with open(os.devnull, "w") as devnull:
for i in range(loops):
if legacy:
print(i)
# This is a macro benchmark for a Python implementation
# so "elapsed" covers more than just how long main() takes.
t0 = pyperf.perf_counter()
Expand All @@ -52,8 +50,12 @@ def _bench_mypy(loops=20, *, legacy=False):
pass
t1 = pyperf.perf_counter()

elapsed += t1 - t0
times.append(t0)
# Don't include results from the first run, since it loads the
# files from disk. Subsequent runs will use the file contents in an
# in-memory cache.
if i > 1:
elapsed += t1 - t0
times.append(t0)
times.append(pyperf.perf_counter())
return elapsed, times

Expand All @@ -67,4 +69,4 @@ def _bench_mypy(loops=20, *, legacy=False):

runner = pyperf.Runner()
runner.metadata['description'] = "Test the performance of mypy types"
runner.bench_time_func("mypy", bench_mypy)
runner.bench_time_func("mypy2", bench_mypy)