Repository navigation
model: residue modification handle as a leaked 'static reference instead of an Arc (#72) - #74
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Warning Review limit reachedNext included review available in 58 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (13)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Full 5,000-spectrum chunk of the phospho search (16 threads,
About 17x on a whole chunk; the larger cache budget buys nothing here, so the default stays. Whole-file projection ≈ 2.3 h at 16 threads instead of ~40 h. |
… MaxQuant reference table (#75) * benchmarks: phospho tier — dataset, mods, MaxQuant reader, reference table First PTM-enriched benchmark. PXD007653 (Krahmer/Mann mouse liver EasyPhos, Q Exactive, single-shot TiO2, label-free), one file: 20151014_QEp6_NaKr_SA_totalliver_control2_phospho.raw, 3.72 GB. Verified against the shipped model store's source ledger — it is NOT training data, unlike the obvious pick PXD014525, which trained hcd_qexactive_tryp_phosphorylation. make_truth.py gains a maxquant reader over msms.txt: decoys dropped (Reverse), PEP <= 0.01, one row per (run, scan), filtered to the run actually searched. It keeps MaxQuant's modified sequence in a seventh column so localisation can be compared later; emit() widens the header only when a reader supplies it, so the glyco tables keep their six columns byte-for-byte. The committed table holds 23,563 spectra, 17,072 of them phospho-bearing. The depositors searched UP000000589, the same mouse proteome the 1:1 shuffled entrapment database is built from, so the comparison is like-for-like apart from isoforms. Numbers follow once the run lands; nothing is claimed here. * benchmarks: mods file takes one residue per line; NumMods=4 The Phospho line specified STY as a single residue spec, which the parser rejects (it takes one residue or `*`), so both arms failed at startup. Split into three lines. NumMods raised 3 -> 4 because 0.2% of the reference peptides carry four variable mods and none carry more than four that we need; at 3 those would be unreachable by construction. * benchmarks: commit the MaxQuant phospho reference table (PXD007653, one file) * benchmarks: first PTM-enriched benchmark — PXD007653 phospho, one file, both arms Default model 36,817–36,922 PSMs @1% (true FDP 1.22–1.32%), --protocol phospho 36,780–36,884 (1.10–1.14%), ~26.7k phospho-bearing PSMs; 82.1% of the MaxQuant reference scans covered with 98.3% bare-peptide agreement. Binary d606d962 (main + #71 + #73 + #74), provenance and recipe recorded. Site localisation is not scored and is listed as the open gap.
…e, not an Arc (#72) Candidate enumeration clones an AminoAcid per position per variant, and each clone of a modified residue bumped the atomic refcount of the shared Modification record. On a phospho search every worker thread hammered the one Phospho refcount: 16 threads burned 4.7x the CPU of one thread for identical output (180 s vs 849 s CPU on a 300-spectrum slice). The per-search modification table is a few dozen records built once, so it is leaked instead and the handle is a plain pointer copy. Construction goes through leak_mod / From<Modification>; with_mod keeps accepting an owned Modification. Output is byte-identical on both backings.
d606d96 to
be6fdda
Compare
Stacked on #73 (base branch
perf/mmap-base-record-cache); second lever for #72.Problem
After #73 the phospho slice still spent 43% in
expand_recursive, and a thread-scaling run showed why: for identical output, 16 threads burned 4.7x the CPU of one thread (849 s vs 180 s on a 300-spectrum slice). EveryAminoAcidclone during enumeration bumped the atomic refcount of the sharedArc<Modification>; on a phospho search every worker thread hammers the single Phospho record's refcount cache line.Change
AminoAcid::mod_isOption<&'static Modification>instead ofOption<Arc<Modification>>. The per-search modification table is a few dozen small records built once, soAminoAcidSetBuilderleaks them (leak_mod) and a clone is a pointer copy.with_modstill accepts an ownedModification(viaFrom), so call sites are unchanged apart from dropping theArc::new. Equality keeps its pointer fast path.Evidence (cluster, same 300-spectrum phospho slice, same inputs, rows identical: 2,878)
Profile after: scoring closure 27%,
base_records_for_nominal_window15%, expansion ~24% total, allocator 12%, sorts 8%.Fixture (E. coli, 4 threads): RAM 11.3 s → 9.6 s, mmap 15.3 s → 14.4 s, PIN byte-identical to the previous build on both backings.
cargo test --workspace1,109 passed; the four ignored RAM/mmap equivalence gates pass.Full 5,000-spectrum chunk timing on this build is running; will post here.