Skip to content

Optimize ward - #533

Merged
andrewdalpino merged 5 commits into
masterfrom
optimize-ward
Nov 23, 2026
Merged

andrewdalpino merged 5 commits into
masterfrom
optimize-ward

Conversation

@andrewdalpino

@andrewdalpino andrewdalpino commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Benchmarks — 4 blobs, d=4, k=4, seed 42, best-of-3 after warm-up, same protocol for both implementations (old pulled from git show HEAD):

n before after speedup
500 0.184 s 0.195 s ≈1.0×
1000 1.115 s 0.868 s 1.28×
2000 5.573 s 4.276 s 1.30×
4000 28.284 s 19.039 s 1.49×
n Old (SplMinHeap + rebuild) New (IndexedMinHeap) Ratio
2000 694 MB peak 196 MB peak 3.5× less
4000 2790 MB peak 774 MB peak 3.6× less

Scaling per doubling improves from ~5.8× (old) to ~4.6×, and the trend keeps widening with n — the old cost's super-exponential shape from heap bloat is gone. At small n the C-implemented SplMinHeap still competes, hence parity at 500.

I also considered an active-cluster list to skip the per-epoch scan of retired clusters; measured the savings (~8M cheap comparisons ≈ 10 ms at n=4000 out of 18 s) aren't worth the added bookkeeping, so I left it out.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants