v0.4.1 — performance recovery
Recovers the Get (hit) and Delete (bulk) regressions flagged in v0.4.0. Single-file refactor of put.go / delete.go / helpers.go; public API unchanged; Len remains O(1).
Performance
median of 5 reps, -benchtime=3s -count=5, VirtualApple @ 2.50 GHz, Go 1.24.2
| Operation | v0.4.0 | v0.4.1 | Δ |
|---|---|---|---|
| Get (hit) | 57.57 ns/op | 44.81 ns/op | fully recovered to pre-generics baseline (43.22 ns/op) |
| Delete (bulk) | 124.5 ns/key | 115.3 ns/key | −9 ns/key (~7 %); residual ~45 ns/key gap vs pre-generics (70.0 ns/key) tracked for follow-up |
ART is now ~21× faster than google/btree on Get (hit), up from 15× at v0.4.0.
What changed
Tree.sizeis now tracked at theinsertLeaf/clearTerminalIfMatcheschokepoints instead of being propagated through recursive return tuples. Parent frames detect no-op by pointer equality on the returned subtree.putInto/putIntoNodeN/deleteFromrevert to single-return-value signatures.- The Get recovery is a code-layout / register-pressure side effect of the put/delete refactor — no change to
get.go.
Documented
benchmarks.mdre-baselined at commitd14c9c6. Regression annotations removed / adjusted.CHANGELOG.mdbackfilled with entries for v0.3.0, v0.4.0, v0.4.1.
Install
go get github.com/KentBeck/AdaptiveRadixTree2@v0.4.1
Compare: v0.4.0...v0.4.1