Skip to content

Raise SL_MAX_TIPS from 2048 to 32768#265

Merged
ms609 merged 1 commit intomainfrom
large-tree-support
Mar 29, 2026
Merged

Raise SL_MAX_TIPS from 2048 to 32768#265
ms609 merged 1 commit intomainfrom
large-tree-support

Conversation

@ms609
Copy link
Copy Markdown
Owner

@ms609 ms609 commented Mar 29, 2026

  • SL_MAX_BINS: 32 -> 512, giving SL_MAX_TIPS = 64 * 512 = 32768
  • Introduce SL_STACK_BINS (32) and SL_STACK_SPLITS (2045) as stack allocation thresholds, keeping SplitList objects at ~548 KB (not bloated)
  • Trees with > 2048 tips use heap allocation in SplitList (transparent to callers)
  • Update splits_to_tree.cpp to use stack thresholds for its local arrays
  • Lookup table cost: ~1 MB (lg2 + lg2_double_factorial + lg2_unrooted)

- SL_MAX_BINS: 32 -> 512, giving SL_MAX_TIPS = 64 * 512 = 32768
- Introduce SL_STACK_BINS (32) and SL_STACK_SPLITS (2045) as stack
  allocation thresholds, keeping SplitList objects at ~548 KB (not bloated)
- Trees with > 2048 tips use heap allocation in SplitList (transparent
  to callers)
- Update splits_to_tree.cpp to use stack thresholds for its local arrays
- Lookup table cost: ~1 MB (lg2 + lg2_double_factorial + lg2_unrooted)
@github-actions
Copy link
Copy Markdown

Performance benchmark results

Call Status Change Time (ms)
as.Splits(bigTrees) ⚪ NSD 1.15% 22.6 →
22.4, 22.4
as.Splits(someTrees) ⚪ NSD 0.06% 11.2 →
11.2, 11
Consensus(forest1k.888, check = FALSE) 🟣 ~same -3.52% 94.7 →
98.1, 97.9
Consensus(forest201.80, check = FALSE) ⚪ NSD -1.01% 3.95 →
3.98, 4
Consensus(forest21.260, 0.5, FALSE) ⚪ NSD -1.36% 1.2 →
1.23, 1.21
Consensus(forest21.260) ⚪ NSD -1.94% 1.22 →
1.25, 1.22
Consensus(forestMaj, 0.5, FALSE) ⚪ NSD -0.47% 2.91 →
2.94, 2.9
DropTip(tr2000, 5) ⚪ NSD 0.1% 16.8 →
16.7, 16.8
DropTip(tr80, 5) ⚪ NSD -0.08% 0.105 →
0.105, 0.105
DropTip(unlen2k, 5) ⚪ NSD 1.69% 0.215 →
0.218, 0.204
DropTip(unlen80, 5) ⚪ NSD -1.22% 0.0401 →
0.0414, 0.0396
lapply(bigSplits, as.phylo) ⚪ NSD 0.56% 29.7 →
29.7, 29.2
lapply(someSplits, as.phylo) ⚪ NSD -6.28% 13.6 →
16.6, 13.7
PathLengths(tr2000, full = TRUE) ⚪ NSD -2.08% 16 →
16.5, 16.3
PathLengths(tr80, full = TRUE) ⚪ NSD -2.74% 0.0976 →
0.102, 0.0985
PathLengths(tr80Unif, full = TRUE) ⚪ NSD -3.64% 0.0992 →
0.105, 0.101
RootTree(tr2000, 5) ⚪ NSD -3.75% 0.378 →
0.386, 0.397
RootTree(tr80, c("t3", "t36")) ⚪ NSD 1.05% 0.0707 →
0.0698, 0.07
RootTree(tr80, "t3") ⚪ NSD -1.8% 0.0495 →
0.0498, 0.0508
RootTree(tr80, "t30") ⚪ NSD -0.62% 0.0499 →
0.0502, 0.0503
RootTree(unlen2k, 5) ⚪ NSD -0.39% 0.329 →
0.332, 0.327
RootTree(unlen80, c("t3", "t36")) ⚪ NSD 1.2% 0.065 →
0.0644, 0.0641
RootTree(unlen80, "t3") ⚪ NSD 0.08% 0.0431 →
0.0432, 0.043
RootTree(unlen80, "t30") ⚪ NSD -0.74% 0.0434 →
0.0438, 0.0436
TreeDist::RobinsonFoulds(forest201.80) ⚪ NSD 0.58% 15.9 →
15.8, 15.8
TreeDist::RobinsonFoulds(forest21.888) ⚪ NSD 0.86% 3.28 →
3.26, 3.23
TreeTools:::path_lengths(tr80$edge, tr80$edge.length, FALSE) ⚪ NSD -2.74% 0.0882 →
0.0926, 0.0886
TreeTools:::postorder_order(bal40) ⚪ NSD -0.68% 0.00163 →
0.00165, 0.00164
TreeTools:::postorder_order(bal40k) ⚪ NSD 0.96% 0.543 →
0.537, 0.538
TreeTools:::postorder_order(dbal40) ⚪ NSD 0% 0.0017 →
0.00171, 0.00168
TreeTools:::postorder_order(dbal40k) ⚪ NSD -3.07% 2.06 →
2.12, 2.14
TreeTools:::postorder_order(dpec40) ⚪ NSD 0% 0.00253 →
0.00253, 0.00253
TreeTools:::postorder_order(dpec40k) ⚪ NSD -0.05% 3300 →
3300, 3300
TreeTools:::postorder_order(drnd80) ⚪ NSD 0.25% 0.00406 →
0.00407, 0.00403
TreeTools:::postorder_order(nbal40) ⚪ NSD -0.5% 0.00201 →
0.00202, 0.00202
TreeTools:::postorder_order(nbal40k) ⚪ NSD 1.34% 2.2 →
2.16, 2.18
TreeTools:::postorder_order(npec40) ⚪ NSD 0.36% 0.00284 →
0.00284, 0.00281
TreeTools:::postorder_order(npec40k) ⚪ NSD 0.02% 3320 →
3320, 3320
TreeTools:::postorder_order(nrnd80) ⚪ NSD 0% 0.00461 →
0.00463, 0.00459
TreeTools:::postorder_order(pec40) ⚪ NSD -0.01% 0.00164 →
0.00165, 0.00164
TreeTools:::postorder_order(pec40k) ⚪ NSD -0.8% 0.43 →
0.431, 0.436
TreeTools:::postorder_order(rnd80) ⚪ NSD 0.95% 0.00211 →
0.00212, 0.00206

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.06%. Comparing base (3c6b286) to head (bbe4679).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #265   +/-   ##
=======================================
  Coverage   96.06%   96.06%           
=======================================
  Files          80       80           
  Lines        5889     5890    +1     
=======================================
+ Hits         5657     5658    +1     
  Misses        232      232           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ms609 ms609 merged commit cfa129a into main Mar 29, 2026
33 of 35 checks passed
@ms609 ms609 deleted the large-tree-support branch March 29, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant