Add monomorphized N-way zipper merge with frontier-based dispatch and specialization#35
Open
marcin-rzeznicki wants to merge 10 commits intomasterfrom
Open
Add monomorphized N-way zipper merge with frontier-based dispatch and specialization#35marcin-rzeznicki wants to merge 10 commits intomasterfrom
marcin-rzeznicki wants to merge 10 commits intomasterfrom
Conversation
It is inefficient
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 generic N-way merge algorithm, extending the existing 2-way and 3-way implementations to arbitrary arity (well,
<= 64) while preserving performance characteristics via specialization and careful traversal design.N-way zipper merge (
zipper_merge_n_mono)const Nand the zipper type (SomeMutRefZ)active) to track participating zippersFrontier-based traversal
|frontier| = 1→ graft (no descent)1 < |frontier| < N→ subset recursion / specialization|frontier| = N→ fast-path full descent (no recursion)Specialized fast paths
zipper_mergezipper_merge3zipper_merge4Introduce macro-based “variadic” frontends and tuple-driven helpers for composing multiple zippers in a single call.
zipper_meet_n!zipper_join_n!zipper_subtract_n!meet_n,join_n,subtract_nSyntax
Tuple-based argument passing
(&mut r1, &mut r2, ..., &rN).meet_n(&mut out)with macro-generated impls up to 64 (current limit: 32)or
zipper_join_n!(r1, r2, r3, ... => w);instead