aboutsummaryrefslogtreecommitdiffhomepage
path: root/benchmarks/by-n/plot.py
diff options
context:
space:
mode:
authorMarvin Borner2024-02-29 14:56:18 +0100
committerMarvin Borner2024-02-29 14:56:18 +0100
commitd64bbff1f00e31a92031a44395958a360c93171b (patch)
treeb92266b3def06f4142d621e52752eddf85679320 /benchmarks/by-n/plot.py
parentb13bc3379a46cc5e45eeede0537f0da323410d85 (diff)
Added benchmarks
Diffstat (limited to 'benchmarks/by-n/plot.py')
-rwxr-xr-xbenchmarks/by-n/plot.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/benchmarks/by-n/plot.py b/benchmarks/by-n/plot.py
new file mode 100755
index 0000000..ba96a0c
--- /dev/null
+++ b/benchmarks/by-n/plot.py
@@ -0,0 +1,32 @@
+#!/bin/env python3
+
+import matplotlib.pyplot as plt
+import json
+import os, glob
+
+
+def render(file):
+ data = json.load(open(file, "r"))["results"]
+ basename = os.path.basename(file).split(".")[0]
+ reducers = list({p["parameters"]["REDUCER"] for p in data})
+ for reducer in reducers:
+ labels = [
+ p["parameters"]["N"]
+ for p in data
+ if p["parameters"]["REDUCER"] == reducer
+ ]
+ times = [
+ p["median"] for p in data if p["parameters"]["REDUCER"] == reducer
+ ]
+ plt.plot(times)
+ plt.xticks(range(len(labels)), labels)
+ plt.legend(reducers)
+ plt.title(f"reducer comparison for {basename}")
+ plt.xlabel("N")
+ plt.ylabel("Time (s)")
+ plt.savefig(f"{basename}.png")
+ plt.close()
+
+
+for file in glob.glob("*.json"):
+ render(file)