aboutsummaryrefslogtreecommitdiffstats
path: root/misc/test/plot-bench.py
diff options
context:
space:
mode:
authorGravatar lvgx <l@vgx.fr>2020-08-21 04:45:45 +0200
committerGravatar GitHub <noreply@github.com>2020-08-21 08:15:45 +0530
commitbcbe8080be6610c265bcbc28879502cd9ab72bfc (patch)
tree572fea1129649f326eb082ecb704cba1db9018cf /misc/test/plot-bench.py
parentd37356a9362d24436f27bad34219755e7e79642a (diff)
downloadnnn-bcbe8080be6610c265bcbc28879502cd9ab72bfc.tar.gz
Add support for Alexey Tourbin's QSORT code (#708)
* Add support for Alexey Tourbin's QSORT code See https://github.com/svpv/qsort * Add benchmark scripts and compilation mode Compile with `make O_BENCHMARK=1`, and run benchmarks with e.g.: ./misc/test/benchmark.sh ./nnn '/' '/usr/bin' '/usr/lib' > benchdata You can then plot basic violin graphs with: ./misc/test/plot-bench.py benchdata * Update style, doc, haiku support, fix lint
Diffstat (limited to 'misc/test/plot-bench.py')
-rwxr-xr-xmisc/test/plot-bench.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/misc/test/plot-bench.py b/misc/test/plot-bench.py
new file mode 100755
index 0000000..b708fec
--- /dev/null
+++ b/misc/test/plot-bench.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+#
+# Usage: ./plot-bench.py datafile
+# (where datafile is the output of benchmark.sh)
+
+import matplotlib.pyplot as plt
+import sys
+
+def bench_file_to_lists(infile):
+ return [[float(entry) for entry in line.split('\t')[1:]] for line in infile.readlines()]
+
+def plot_data(data):
+ fig = plt.figure()
+ ax = fig.add_axes([0,0,1,1])
+ ax.violinplot(data)
+ plt.savefig("plot.svg")
+
+filename = sys.argv[1]
+
+plot_data(bench_file_to_lists(open(filename)))