Skip to content

Read the permutation null's draws from a rank table when every block ranks against its whole bucket - #338

Merged
timtreis merged 2 commits into
mainfrom
perf/map-permutation-ranktable
Nov 15, 2026
Merged

timtreis merged 2 commits into
mainfrom
perf/map-permutation-ranktable

Conversation

@timtreis

@timtreis timtreis commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

When every block ranks against its whole bucket with nothing subtracted (replicability and cross_plate modes), the permutation null now builds a uint16 table of each key's rank within its profile's sorted row. A draw then counts the negatives before a positive as its rank less the ranks of the drawn profiles below it, so it scores no similarities and searches no rows.

The table is used only when it fits beside the sorted similarities in the new mt.settings.map_table_bytes (half of the machine's memory by default, replacing the fixed 8 GiB store budget), rows hold at most 65,535 keys and no key is NaN. Activity mode, multilabel columns and larger tables keep the current path, and a table skipped for its size is logged. _tables also returns early when it can table nothing.

Verified: a new test checks that the rank table and the sorted keys give identical p-values and scores, with and without ties and duplicate profiles, and that a budget below the table size falls back. The copairs equivalence and tl evaluation tests pass (185). On Aconcagua replicability at null_size 10,000, the whole scoring run takes about 8.5 minutes.

On Aconcagua (main's r7 file, replicability, null_size 10,000), scores, p-values and q-values are bit-identical to main for all 500 groups.

…ranks against its whole bucket

A uint16 table of each key's rank within its profile's sorted row replaces the drawn-pair similarities and the searches, so a draw scores nothing. It is used when it fits RANK_BUDGET; otherwise the sorted keys serve as before. _tables also returns early when it can table nothing.
@read-the-docs-community

read-the-docs-community Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

@codecov-commenter

codecov-commenter commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 37.90850% with 95 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.16%. Comparing base (027abfb) to head (78d35e9).

Files with missing lines Patch % Lines
src/mantispy/_core/_map_permutation.py 34.72% 94 Missing ⚠️
src/mantispy/_settings.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #338      +/-   ##
==========================================
- Coverage   76.48%   76.16%   -0.32%     
==========================================
  Files         100      100              
  Lines       13813    13934     +121     
==========================================
+ Hits        10565    10613      +48     
- Misses       3248     3321      +73     
Files with missing lines Coverage Δ
src/mantispy/tl/_map.py 96.73% <ø> (ø)
src/mantispy/_settings.py 90.90% <88.88%> (+2.67%) ⬆️
src/mantispy/_core/_map_permutation.py 52.58% <34.72%> (-3.33%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…t.settings.map_table_bytes

One setting, half of the machine's memory by default, replaces the fixed 8 GiB store budget and the rank-table budget. A rank table that does not fit beside the sorted similarities is logged and skipped.
@timtreis
timtreis merged commit 8db0c7d into main Nov 15, 2026
12 of 14 checks passed
@timtreis
timtreis deleted the perf/map-permutation-ranktable branch November 15, 2026 05:16
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.

2 participants