nnn/misc/test/plot-bench.py
lvgx bcbe8080be
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
2020-08-21 08:15:45 +05:30

21 lines
481 B
Python
Executable file

#!/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)))