DNF zipper merge#40
Open
marcin-rzeznicki wants to merge 4 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a DNF-based zipper merge engine capable of evaluating expressions of the form:
where each conjunctive clause is evaluated as an intersection (
Meet) of zipper frontiers, and the resulting clauses are combined using union (Join).The implementation extends the existing zipper merge framework while preserving:
Representation
The new interface operates on clauses:
Each clause represents a conjunction of zippers:
Clause lengths are dynamic while the number of clauses (
M) remains const-generic for efficient mask-based dispatch.Traversal strategy
At each node:
For each byte in the global frontier:
Iterative unanimous descent
A key optimization is the detection of unanimous clause continuation:
if sub_active == activeIn this case:
This eliminates stack growth on long shared paths and restores the same “tail-descent spine” optimization used by the original mono merge engine.
Recursion behavior
Recursion now occurs only on true branching points:
which bounds recursive depth by branching structure rather than trie depth.
State model
Unlike the original zipper merge, DNF traversal introduces aggregate evaluator state:
Rather than storing this state explicitly across descent, the implementation recomputes it after ascent from zipper positions.
This keeps traversal state lightweight while relying on inexpensive bitmask recomputation.
Performance notes
The implementation preserves several optimizer-friendly properties:
Mis const-generic,The hot path is dominated by compact bitmask operations and zipper movement rather than evaluator bookkeeping.