Repository navigation
Slab: reap only the wavefronts handed out since the last reap (port of C #140) - #58
Merged
Merged
Conversation
Port of Marco-Sola-Lab/WFA2-lib#140. In high memory, reap_cigar walked every wavefront the slab had ever created before each alignment. After a long alignment that is thousands, so every following short alignment paid for it (~70% of a mixed run's samples). The slab now records the indices it hands out (busy) and, with no mixed lengths (C's dirty), returns only those. Recording is done only while the slab has >= 4096 wavefronts, so uniform short workloads don't pay for it, and a busy set of a quarter of the slab or more still takes the ordered full walk. C's #140 benchmark (10 x 10 kb then 200k x 100 bp, high): 1231 -> 365 ms (C after #140: 421 ms). A dada2-like interleaved workload: 735 -> 209 ms. Output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 18, 2026
Open
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.
Ports Marco-Sola-Lab/WFA2-lib#140 (
cda19a0, already in the pinned C commit). I had listed it as "speed only, n/a", but Rust had the same problem, and worse. Relevant to #31 and to dada2-rs, whose per-thread aligner sees mixed read lengths in high memory.Problem
In high memory (CIGAR),
init_alignmentcallsWavefrontSlab::reap_cigar. It walked every wavefront the slab had ever created, including deallocated ones. A long alignment leaves thousands of them, so every short alignment that followed paid for the whole walk.sampleput about 70% of a mixed run inreap_cigar.Fix
busy).mixed_lengths, C'sdirty),reap_cigarreturns only those indices. That's safe because every other live wavefront is already on the free list.debug_assertcovers the invariant: a deallocation implies mixed lengths.Results
M2 Pro, median of 7, alignment time in ms, on C's benchmark data (10 × 10 kb then 200k × 100 bp, 5% error, gap-affine):
mainInterleaved workload (each 10 kb pair followed by 300 × 100 bp), median of 5:
-5,4,0,8, ends-free 0.1, banded ±16, corrected): 735 → 209 ms;Validation
mainon the interleaved set for every metric, in high/med/ultralow and score-only, plus corrected ends-free (affine and linear, banded) and X-drop.test_reap_cigar_busy_after_large_slab. Tests pass in release and debug, so thedebug_assertran; clippy is clean.PERFORMANCE_LOG and PROGRESS are updated; C #140 is now marked as ported.
🤖 Generated with Claude Code