Skip to content

Commit cb59b2b

Browse files
konardclaude
andcommitted
Fix first benchmark image to use raw values instead of floor division
The original bench1() function used floor division by 10,000,000 which caused all Doublets values (71-1465 ns) to become 1 after clamping, making all bars appear the same length. Changed to use raw values directly (matching bench2's approach but without log scale). Now bars correctly reflect actual time differences - Neo4j operations show their true longer times while Doublets values are so small they appear minimal (as expected and noted in README: "for doublets just minimum value is shown, otherwise it will be not present on the graph"). Fixes #7 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ca44bd3 commit cb59b2b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

rust/out.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,18 @@ def annotate(v):
132132
# Plots
133133
# ─────────────────────────────────────────────────────────────────────────────
134134
def bench1():
135-
"""Horizontal bars – scaled (divide by 10 000 000)."""
136-
scale = lambda arr: [max(1, x // 10_000_000) for x in arr]
135+
"""Horizontal bars – raw values (pixel scale)."""
137136
y, w = np.arange(len(ordered_ops)), 0.1
138137
fig, ax = plt.subplots(figsize=(12, 8))
139138

140-
ax.barh(y - 2*w, scale(du_volatile_arr), w, label='Doublets United Volatile', color='salmon')
141-
ax.barh(y - w, scale(du_nonvolatile_arr),w, label='Doublets United NonVolatile',color='red')
142-
ax.barh(y , scale(ds_volatile_arr), w, label='Doublets Split Volatile', color='lightgreen')
143-
ax.barh(y + w, scale(ds_nonvolatile_arr), w, label='Doublets Split NonVolatile', color='green')
144-
ax.barh(y + 2*w, scale(neo4j_non_arr), w, label='Neo4j NonTransaction', color='lightblue')
145-
ax.barh(y + 3*w, scale(neo4j_trans_arr), w, label='Neo4j Transaction', color='blue')
139+
ax.barh(y - 2*w, du_volatile_arr, w, label='Doublets United Volatile', color='salmon')
140+
ax.barh(y - w, du_nonvolatile_arr,w, label='Doublets United NonVolatile',color='red')
141+
ax.barh(y , ds_volatile_arr, w, label='Doublets Split Volatile', color='lightgreen')
142+
ax.barh(y + w, ds_nonvolatile_arr, w, label='Doublets Split NonVolatile', color='green')
143+
ax.barh(y + 2*w, neo4j_non_arr, w, label='Neo4j NonTransaction', color='lightblue')
144+
ax.barh(y + 3*w, neo4j_trans_arr, w, label='Neo4j Transaction', color='blue')
146145

147-
ax.set_xlabel('Time (ns) – scaled')
146+
ax.set_xlabel('Time (ns)')
148147
ax.set_title ('Benchmark Comparison: Neo4j vs Doublets (Rust)')
149148
ax.set_yticks(y); ax.set_yticklabels(ordered_ops); ax.legend()
150149
fig.tight_layout(); plt.savefig("bench_rust.png"); plt.close(fig)

0 commit comments

Comments
 (0)