aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-09-30 13:23:52 +0200
committerDavid Robillard <d@drobilla.net>2022-01-14 19:37:51 -0500
commitf55c6a35fba2851ba909cab433f0a94f8a1d4107 (patch)
tree60d7d6e14681a69d8a70e9a1bb67d3e128d0ff28
parente9b773bf452f0df0ea69e363bcb5899fea124b28 (diff)
downloadserd-f55c6a35fba2851ba909cab433f0a94f8a1d4107.tar.gz
serd-f55c6a35fba2851ba909cab433f0a94f8a1d4107.tar.bz2
serd-f55c6a35fba2851ba909cab433f0a94f8a1d4107.zip
Add model to benchmarks
-rwxr-xr-xscripts/serd_bench.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/serd_bench.py b/scripts/serd_bench.py
index 2ecaf8eb..018734c4 100755
--- a/scripts/serd_bench.py
+++ b/scripts/serd_bench.py
@@ -43,8 +43,8 @@ def gen(sp2b_dir, n_min, n_max, step):
def write_header(results, progs):
"Write the header line for TSV output"
- results.write("n")
- for prog in progs:
+ results.write("n\tserdi_stream\tserdi_model")
+ for prog in progs[2:]:
results.write("\t" + os.path.basename(prog.split()[0]))
results.write("\n")
@@ -145,13 +145,15 @@ def run(progs, n_min, n_max, step):
cmd = "/usr/bin/time -v " + prog + " " + filename(n)
with open(filename(n) + ".out", "w") as out:
sys.stderr.write(cmd + "\n")
- proc = subprocess.Popen(
+ proc = subprocess.run(
cmd.split(), stdout=out, stderr=subprocess.PIPE
)
- time, memory = parse_time(proc.communicate()[1].decode())
+ time, memory = parse_time(proc.stderr.decode())
rows["time"] += ["%.07f" % time]
- rows["throughput"] += ["%d" % (n / time)]
+ rows["throughput"] += (
+ ["%d" % (n / time)] if time > 0.0 else ["0"]
+ )
rows["memory"] += [str(memory)]
# Write rows to output files
@@ -223,7 +225,11 @@ example:
args = ap.parse_args(sys.argv[1:])
- progs = ["serdi -b -f -i turtle -o turtle"] + args.run
+ progs = [
+ "serdi -b -i turtle -o turtle",
+ "serdi -m -b -i turtle -o turtle",
+ ] + args.run
+
min_n = int(args.max / 10)
max_n = args.max
step = min_n