Skip to content
Snippets Groups Projects
Verified Commit 954fd6d3 authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

plot commit for all curves

parent da2a71a1
No related branches found
No related tags found
1 merge request!69work on the benchmarks
......@@ -162,8 +162,13 @@ def plot_commit(data: Data, save: bool = False):
fig, ax = plt.subplots(1, 1, figsize=(16, 9))
# key: the start of the `$.id` field
def plot(data: Data, key: str, color: str, ax):
filtered_data = list(filter(lambda line: line["id"].startswith(key), data))
def plot(data: Data, key: str, curve: str, style: str, color: str, ax):
filtered_data = list(filter(
lambda line: line["id"].startswith(key) and line["id"].endswith(f" on {curve}"),
data
))
if len(filtered_data) == 0:
return
sizes = [
int(line["id"].lstrip(key).split(' ')[0]) for line in filtered_data
......@@ -173,14 +178,12 @@ def plot_commit(data: Data, save: bool = False):
up = ns_to_ms(extract(filtered_data, "mean", "upper_bound"))
down = ns_to_ms(extract(filtered_data, "mean", "lower_bound"))
ax.plot(sizes, means, label=key, color=color)
ax.fill_between(sizes, down, up, color=color, alpha=0.3)
keys = ["commit (komodo)", "commit (arkworks)"]
colors = ["blue", "orange"]
ax.plot(sizes, means, label=f"{key} on {curve}", color=color, linestyle=style)
ax.fill_between(sizes, down, up, color=color, linestyle=style, alpha=0.3)
for (k, c) in zip(keys, colors):
plot(data, key=k, color=c, ax=ax)
for (curve, color) in [("BLS12-381", "blue"), ("BN-254", "orange"), ("PALLAS", "green")]:
plot(data, key="commit (komodo)", curve=curve, style="solid", color=color, ax=ax)
plot(data, key="commit (arkworks)", curve=curve, style="dashed", color=color, ax=ax)
ax.set_title("commit times")
ax.set_ylabel("time (in ms)")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment