diff options
Diffstat (limited to 'scripts/serd_bench.py')
-rwxr-xr-x | scripts/serd_bench.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/scripts/serd_bench.py b/scripts/serd_bench.py index db8c1c5b..35869ce6 100755 --- a/scripts/serd_bench.py +++ b/scripts/serd_bench.py @@ -76,8 +76,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\tserd-pipe\tserd-sort") + for prog in progs[2:]: results.write("\t" + os.path.basename(prog.split()[0])) results.write("\n") @@ -191,13 +191,18 @@ 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( - cmd.split(), stdout=out, stderr=subprocess.PIPE + proc = subprocess.run( + cmd.split(), + check=True, + 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 @@ -272,7 +277,11 @@ example: args = ap.parse_args(sys.argv[1:]) serd_opts = "-I turtle -I verbatim -O turtle -O verbatim -O expanded" - progs = ["tools/serd-pipe " + serd_opts] + args.run + progs = [ + "tools/serd-pipe " + serd_opts, + "tools/serd-sort " + serd_opts, + ] + args.run + min_n = int(args.max / args.steps) max_n = args.max step = min_n |