Files
2026-05-07 13:55:02 +01:00

24 lines
571 B
Python

import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("benchmark.csv")
plt.figure(figsize=(10, 6))
plt.plot(df["elements"], df["hash"], marker='o', label="Hash map")
plt.plot(df["elements"], df["array"], marker='o', label="Array")
# LOG SCALE
plt.xscale("log")
plt.yscale("log")
plt.xlabel("Number of elements (log scale)")
plt.ylabel("Time (ms) (log scale)")
plt.title("Array vs Hash Map Lookup Performance")
plt.grid(True, which="both", linestyle="--", alpha=0.5)
plt.legend()
plt.show()
plt.savefig("benchmark.png", dpi=200, bbox_inches="tight")