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
4 changes: 4 additions & 0 deletions bench_runner/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def _load_contents(filename: Path) -> dict[str, Any]:
return json.load(fd)


def clear_contents_cache() -> None:
_load_contents.cache_clear()


def _clean(string: str) -> str:
"""
Clean an arbitrary string to be suitable for a filename.
Expand Down
7 changes: 7 additions & 0 deletions bench_runner/scripts/bisect.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def parse_result(benchmark_json: PathLike) -> float:
# The name of the benchmark in the JSON file may be different from the one
# used to select the benchmark. Therefore, just take the mean of all the
# benchmarks in the JSON file.
result.clear_contents_cache()
r = result.Result.from_arbitrary_filename(benchmark_json)
timing_data = r.get_timing_data()
return float(np.mean([x.mean() for x in timing_data.values()]))
Expand Down Expand Up @@ -123,6 +124,12 @@ def _main(
bad_timing = get_result(benchmark, pgo, flags, cpython=cpython)
log(f"KNOWN BAD ({bad[:7]}): {format_seconds(bad_timing)}")

if good_timing >= bad_timing:
show_log()
raise ValueError(
f"Good timing ({good_timing}) must be less than bad timing ({bad_timing})."
)

try:
with contextlib.chdir(cpython):
subprocess.run(["git", "bisect", "start"])
Expand Down