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

plot all curves in setup

parent 8bb64f99
No related branches found
No related tags found
No related merge requests found
...@@ -99,7 +99,7 @@ def plot_setup(data: Data, save: bool = False): ...@@ -99,7 +99,7 @@ def plot_setup(data: Data, save: bool = False):
fig, axs = plt.subplots(4, 1, sharex=True, figsize=(16, 9)) fig, axs = plt.subplots(4, 1, sharex=True, figsize=(16, 9))
# key: the start of the `$.id` field # key: the start of the `$.id` field
def plot(data: Data, key: str, curve: str, label: str, color: str, error_bar: bool, ax): def plot(data: Data, key: str, curve: str, label: str, color: str, style: str, error_bar: bool, ax):
filtered_data = list(filter( filtered_data = list(filter(
lambda line: line["id"].startswith(key) and line["id"].endswith(f" on {curve}"), lambda line: line["id"].startswith(key) and line["id"].endswith(f" on {curve}"),
data data
...@@ -116,41 +116,43 @@ def plot_setup(data: Data, save: bool = False): ...@@ -116,41 +116,43 @@ def plot_setup(data: Data, save: bool = False):
else: else:
means = b_to_kb(extract(filtered_data, "mean", None)) means = b_to_kb(extract(filtered_data, "mean", None))
ax.plot(sizes, means, label=label, color=color) ax.plot(sizes, means, label=f"{label} on {curve}", color=color, linestyle=style)
if error_bar: if error_bar:
ax.fill_between(sizes, down, up, color=color, alpha=0.3) ax.fill_between(sizes, down, up, color=color, alpha=0.3)
curve = "BLS12-381"
# setup # setup
plot(data, "setup/setup (komodo)", curve, "komodo", "orange", True, axs[0]) for (curve, color) in [("BLS12-381", "blue"), ("BN-254", "orange"), ("PALLAS", "green")]:
plot(data, "setup (arkworks)", curve, "arkworks", "blue", True, axs[0]) plot(data, "setup/setup (komodo)", curve, "komodo", color, "solid", True, axs[0])
plot(data, "setup (arkworks)", curve, "arkworks", color, "dashed", True, axs[0])
axs[0].set_title("time to generate a random trusted setup") axs[0].set_title("time to generate a random trusted setup")
axs[0].set_ylabel("time (in ms)") axs[0].set_ylabel("time (in ms)")
axs[0].legend() axs[0].legend()
axs[0].grid() axs[0].grid()
# serialization # serialization
plot(data, "setup/serializing with compression", curve, "compressed", "orange", True, axs[1]) for (curve, color) in [("BLS12-381", "blue"), ("BN-254", "orange"), ("PALLAS", "green")]:
plot(data, "setup/serializing with no compression", curve, "uncompressed", "blue", True, axs[1]) plot(data, "setup/serializing with compression", curve, "compressed", color, "solid", True, axs[1])
plot(data, "setup/serializing with no compression", curve, "uncompressed", color, "dashed", True, axs[1])
axs[1].set_title("serialization") axs[1].set_title("serialization")
axs[1].set_ylabel("time (in ms)") axs[1].set_ylabel("time (in ms)")
axs[1].legend() axs[1].legend()
axs[1].grid() axs[1].grid()
# deserialization # deserialization
plot(data, "setup/deserializing with no compression and no validation", curve, "uncompressed unvalidated", "red", True, axs[2]) for (curve, color) in [("BLS12-381", "blue"), ("BN-254", "orange"), ("PALLAS", "green")]:
plot(data, "setup/deserializing with compression and no validation", curve, "compressed unvalidated", "orange", True, axs[2]) plot(data, "setup/deserializing with no compression and no validation", curve, "uncompressed unvalidated", color, "dotted", True, axs[2])
plot(data, "setup/deserializing with no compression and validation", curve, "uncompressed validated", "blue", True, axs[2]) plot(data, "setup/deserializing with compression and no validation", curve, "compressed unvalidated", color, "dashed", True, axs[2])
plot(data, "setup/deserializing with compression and validation", curve, "compressed validated", "green", True, axs[2]) plot(data, "setup/deserializing with no compression and validation", curve, "uncompressed validated", color, "dashdot", True, axs[2])
plot(data, "setup/deserializing with compression and validation", curve, "compressed validated", color, "solid", True, axs[2])
axs[2].set_title("deserialization") axs[2].set_title("deserialization")
axs[2].set_ylabel("time (in ms)") axs[2].set_ylabel("time (in ms)")
axs[2].legend() axs[2].legend()
axs[2].grid() axs[2].grid()
plot(data, "serialized size with no compression", curve, "uncompressed", "orange", False, axs[3]) for (curve, color) in [("BLS12-381", "blue"), ("BN-254", "orange"), ("PALLAS", "green")]:
plot(data, "serialized size with compression", curve, "compressed", "blue", False, axs[3]) plot(data, "serialized size with no compression", curve, "uncompressed", color, "dashed", False, axs[3])
plot(data, "serialized size with compression", curve, "compressed", color, "solid", False, axs[3])
axs[3].set_title("size") axs[3].set_title("size")
axs[3].set_xlabel("degree") axs[3].set_xlabel("degree")
axs[3].set_ylabel("size (in kb)") axs[3].set_ylabel("size (in kb)")
......
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