T-298: perf(quartet_concordance): hoist buffer resize outside split loop#242
Open
ms609 wants to merge 2 commits into
Open
T-298: perf(quartet_concordance): hoist buffer resize outside split loop#242ms609 wants to merge 2 commits into
ms609 wants to merge 2 commits into
Conversation
Resize n0/n1 only when a new character has more states than current buffer capacity (once per character rather than once per taxon × split). Also compute max_state in the existing char-column pass (no extra loop). Adds dev/benchmarks/bench_quartet_concordance.R for timing at small/medium/large scales and profvis flame-graph support. Benchmarks (Windows, R 4.5): small (<1ms), medium (14ms), large (186ms) per call at 25/100/300 taxa respectively. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ms609
added a commit
that referenced
this pull request
May 13, 2026
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
n0/n1buffer resize outside the split loop: was resize-per-char-per-split, now resize only when a new character has more states than current capacity (once per character in the worst case).max_statein the existing char-column caching pass — no extra loop added.dev/benchmarks/bench_quartet_concordance.Rfor timing and profvis flame-graph.Analysis notes (T-298)
NumericMatrixfor output-O2inlines Rcpp accessor to a single pointer dereferenceintvsdoublen0/n1are alreadyint; output correctly usesdouble(decisive values can be half-integers)base + nrow * sunder-O2; no profile evidence of residual overhead — left aloneBenchmark results (Windows, R 4.5.2, seed 42)
Test plan
test-QuartetConcordancetests🤖 Generated with Claude Code