Skip to content

Commit

Permalink
benchmark: fixup comparison figure ycsb-c (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwuensche authored Apr 16, 2024
1 parent 585b5fa commit 0e8a726
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 3 additions & 1 deletion betree/haura-benchmarks/haura-plots/haura_plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ def main():

# Grouped Plots
for group in list({run["group"] for run in filter(lambda x: x is not None, ycsb_c)}):
ycsb_plots.plot_grouped_c(group, list(filter(lambda x: x["group"] == group, ycsb_c)))
ycsb_plots.plot_grouped_c(group, list(filter(lambda x: x is not None and x["group"] == group, ycsb_c)))
# Entire plot
ycsb_plots.plot_grouped_c('/'.join(sys.argv[1].split('/')[:-2]), list(filter(lambda x: x is not None, ycsb_c)), overall=True)


if __name__ == "__main__":
Expand Down
20 changes: 15 additions & 5 deletions betree/haura-benchmarks/haura-plots/haura_plots/ycsb_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def plot_c(path):
ax.set_ylabel("Throughput [op/s]")
ax.set_title(f"YCSB-C Scaling | {' | '.join(path.split('/')[-2:])}")
ax.set_xlabel("Threads [#]")
fig.legend()
ax.legend(loc='upper left')
fig.savefig(f"{path}/ycsb_c.svg")
return {
"title": path.split('/')[-1:][0],
Expand All @@ -34,7 +34,7 @@ def plot_c(path):
"results": data["ops"] / (data["time_ns"] / 10**9),
}

def plot_grouped_c(path, runs):
def plot_grouped_c(path, runs, overall=False):
"""
Bar chart for YCSB-C-esque scalability over multiple runs.
"""
Expand All @@ -44,14 +44,24 @@ def plot_grouped_c(path, runs):
fig, ax = plt.subplots()
off = 1 / (len(runs) + 1)
for idx, run in enumerate(runs):
if not overall:
title = run["title"]
else:
group = run["group"].split('/')[-1:][0]
title = run["title"] + "[" + group + "]"
ax.bar(
[l - off * ((len(runs)-1)/2) + idx * off for l in run["threads"]],
run["results"],
off,
label=run["title"]
label=title
)

group = runs[0]["group"].split('/')[-1:][0]
ax.set_title(f'YCSB Scaling | {group}')
if not overall:
group = runs[0]["group"].split('/')[-1:][0]
ax.set_title(f'YCSB Scaling | {group}')
else:
ax.set_title(f'YCSB Scaling')
ax.set_ylabel("Throughput [op/s]")
ax.set_xlabel("Threads [#]")
extra = fig.legend(loc="upper left", bbox_to_anchor=(0.9, 0.89))
fig.savefig(f"{path}/ycsb_c_comparison.svg", bbox_extra_artists=(extra,), bbox_inches="tight")

0 comments on commit 0e8a726

Please sign in to comment.