You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ae7cdda
Browse filesBrowse the repository at this point in the historyBrowse files
Merge a delta into an Index without visiting entries only the receiver holds (#786)
Index.mergeDifferences calls the merge function for every key present on
only one side, so merging a one-entry index into a large one walked the
whole receiver: 100,001 calls at 100,000 entries, resolving every child.
Index.merge(Index, MergeFunction) is the function-taking form of
AMap.merge: for each key of the other index it applies the function to the
receiver's value (or null) and the other's, and keeps keys only the
receiver holds as they are without calling it. It reuses the structural
merge through a private marker on the function, so MergeFunction is
unchanged; sub-tries off the paths to the merged keys are shared without
being traversed. The stack-safe fallback walks only the other index.
RowLWW.mergeRows uses it when the incoming side carries only rows, as a row
delivery does, where the creation check cannot affect rows the table holds,
and the live count is then adjusted from the delivered keys instead of
recounting the table. Tests check the contract against a naive oracle, one
call for one merged key into 10,000 entries, unreached sub-tries never
read, the deep fallback, and a row delivery into a table whose other rows
are not loaded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
12
12
- Let applications choose how each Convex DB database merges, with per-row last-write-wins provided as one policy. ([Merge Policy](convex-db/docs/LATTICE-DB-ARCHITECTURE.md#merge-policy), [#779](https://github.com/Convex-Dev/convex/issues/779), [#784](https://github.com/Convex-Dev/convex/issues/784))
13
13
- Let applications supply the clock that stamps Convex DB writes. ([Clock](convex-db/docs/LATTICE-DB-ARCHITECTURE.md#clock), [#781](https://github.com/Convex-Dev/convex/issues/781))
14
+
- Merge a small delta into a large `Index` without visiting the rest of it, with `Index.merge`; Convex DB row deliveries now cost the rows delivered, not the table. ([#786](https://github.com/Convex-Dev/convex/issues/786))
0 commit comments