Speed up transitive closure and GFA emission - #143
Merged
Conversation
Share the per-chunk seen-bitvector across BFS workers by reference instead of deep-copying it per worker. The copy was quadratic in input length (input x chunks x workers) and dominated large runs: on a 392 Mbp yeast pangenome (182 Mbp graph, -t8) it cuts runtime 895s -> 98s (9.1x), output byte-identical. Smaller output-preserving wins: - range_buffer uses FxHashMap instead of SipHash (per-base hot map) - skip last_seq_pos insert when min-repeat-distance is 0 - flush_ranges uses in-place retain (no temp Vec) - uppercase sequences in place on import - stream S-lines and format ints with itoa in GFA emission - byte-based CIGAR parser Byte-identical GFA across HLA (28 loci) and yeast pangenomes up to 182 Mbp. 116 tests pass.
AndreaGuarracino
force-pushed
the
optimize-transclosure
branch
from
July 23, 2026 13:59
5a608af to
f6a295a
Compare
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.
Speeds up seqwish with byte-identical output.
The transitive-closure BFS deep-copied the whole seen-bitvector once per worker per chunk. That copy is quadratic in input length and dominates large runs. Sharing one
&[bool]fixes it. The other changes are smaller output-preserving cleanups.Measured (byte-identical output in every case):
The speedup grows with input size because the removed copy was quadratic.
Also bundled, all output-preserving:
range_bufferuses FxHashMap instead of SipHash (the per-base hot map)last_seq_posinsert when min-repeat-distance is 0 (dead work by default)flush_rangesuses in-place retain (no temp Vec)Correctness: byte-identical GFA on all 28 HLA loci and yeast pangenomes up to 182 Mbp; 116 tests pass.