Tweak benchmark script to handle missing benchmark files

This commit is contained in:
akp 2021-12-22 19:11:59 +00:00
parent a622a2e25b
commit 20a76112e7
No known key found for this signature in database
GPG key ID: AA5726202C8879B7

View file

@ -29,8 +29,16 @@ files = [os.path.join(x, "benchmark.json") for x in directories]
benchmark_data = {"Python": {}, "Golang": {}, "Nim": {}} # adding dicts here sets the order of points being plotted
for filename in files:
with open(os.path.join(path, filename)) as f:
data = json.load(f)
fpath = os.path.join(path, filename)
try:
f = open(fpath)
except FileNotFoundError:
print(f"Warning: missing file {fpath}")
continue
data = json.load(f)
f.close()
for language in data["implementations"]:
x = benchmark_data.get(language, {})
x[str(data["day"]) + ".1"] = data["implementations"][language]["part.1.avg"]