Repository navigation
Reuse indexed readers per worker thread - #111
Merged
Merged
Conversation
Reuse a lazily opened reader keyed by input and reference paths across regions in all depth-processing modes. Cover repeated fetches, input changes, and reference switching with regression tests. Synthetic short-interval BAM benchmarks improved 2.17x for base-depth and 3.46-3.54x for only-depth; CRAM improvements were 4-6%. Implemented with Amp; pending human review. Amp-Thread-ID: https://ampcode.com/threads/T-01a18c50-92d6-73c8-af62-326ba8f97fd3 Co-authored-by: Amp <amp@ampcode.com>
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.
Summary
Closes #110.
Reuse a lazily opened, thread-local indexed BAM/CRAM reader across regions in base-depth and both only-depth paths. The cache is keyed by input and reference paths. RegionProcessor and counting logic are unchanged.
Regression coverage exercises repeated fetches, backward seeks, empty regions, contig changes, input-file changes, and CRAM reference switching. The reference-switch test was verified to fail when reference-path cache invalidation was temporarily disabled; only that test disables CRAM MD5 validation to make the selected reference observable.
Benchmark results
Synthetic warm-cache local-file benchmarks on Apple M3, release builds, four processing workers, two warmups and seven measured runs. Input contains 39,992 reads over two 1 Mb contigs.
BAM with 20,000 short BED intervals:
CRAM with 200 short intervals improved 4–6%. Whole-input controls were approximately unchanged. These are workload-specific measurements, not production-data performance guarantees.
Validation
An existing reference/zero-depth TSV column-count bug was reproduced in both versions and is addressed in a separate, stacked draft PR.
AI disclosure
Implemented with Amp. Draft for human review.