Skip to content

Sort PeptideIndexing matches once after the parallel database search - #10429

Merged
timosachsenberg merged 2 commits into
OpenMS:developfrom
timosachsenberg:perf/peptideindexing-sort-once
Oct 8, 2026
Merged

timosachsenberg merged 2 commits into
OpenMS:developfrom
timosachsenberg:perf/peptideindexing-sort-once

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

PeptideIndexing currently sorts the entire accumulated peptide–protein match vector inside the critical section after every thread/chunk merge. This repeatedly sorts earlier matches and keeps other threads waiting.

Move the sort after the parallel region so the complete vector is sorted once. Merging only appends matches, and downstream consumers still receive the same order by peptide index, protein index, position and flanking residues. Includes a changelog entry.

Extracted unchanged from #10403; this PR contains only the PeptideIndexing optimization and does not include ProSE's index-based protein mapping.

Validation:

  • Locally compiled the changed PeptideIndexing.cpp and the existing PeptideIndexing class test with GCC 13.3, C++23, Debug and OpenMP enabled, linking unchanged dependencies against the available pyOpenMS nightly libOpenMS.
  • All existing PeptideIndexing class tests passed with OMP_NUM_THREADS=1, 2, 4 and 8 (4/4 CTest runs).
  • git diff --check passed. The uploaded Git tree matches the locally validated tree.

A full OpenMS build was not run.

Summary by CodeRabbit

  • Performance
    • Peptide indexing now sorts peptide–protein matches once after the parallel database search, rather than sorting repeatedly during processing. Matching results and their ordering remain unchanged. This reduces repeated sorting work while preserving the same indexing output.

Benchmark

Paired Release builds (GCC 13.3, C++23, -O3, OpenMP), original develop fe7b9cc vs this change. Unchanged dependencies link against the same nightly libOpenMS. AMD EPYC 9V74 VM, 9 visible CPUs / 8 CPU quota; OMP_WAIT_POLICY=PASSIVE. One excluded warm-up pair and three measured pairs per configuration, alternating before/after order. Times are median wall time of the complete PeptideIndexing::run call, excluding input loading/digestion/PSM generation and output comparison.

Dataset Threads Before (s) After (s) Time reduction
E. coli 1 0.285 0.325 -13.9%
E. coli 2 0.256 0.273 -6.9%
E. coli 4 0.237 0.210 11.4%
E. coli 8 0.224 0.210 6.4%
Synthetic, two chunks 1 1.952 1.916 1.9%
Synthetic, two chunks 2 1.574 1.585 -0.7%
Synthetic, two chunks 4 1.286 1.229 4.4%
Synthetic, two chunks 8 1.453 1.128 22.4%

Inputs:

  • Repository E. coli target/decoy FASTA: 8,272 proteins; 20,000 distinct generated tryptic peptides (length 7–30, up to one missed cleavage, seeded sampling), repeated five times into 100,000 PSMs; 101,820 peptide evidences.
  • Synthetic shared-peptide/chunk stress case: 420,000 proteins made by repeating 2,000 sampled peptide sequences as separate proteins with unique accessions; 10,000 PSMs and 2,109,450 peptide evidences. Exercises the 400,000-protein cache boundary.

All 64 runs produced identical serialized peptide evidences (accession, start/end, flanking residues), target/decoy and unique/shared annotations, and protein-hit lists within each dataset, across both versions and all thread counts. Peak process RSS is effectively unchanged (about 143–149 MiB for E. coli, 429–461 MiB for the stress case).

The clearest gain is the synthetic chunked case at 8 threads: 22.4% less indexing time (1.453 -> 1.128 s). Most other ranges overlap: these short, shared-VM runs do not establish a general speedup or a single-thread regression. The E. coli inputs use generated PSMs, not observed search results; the large case is synthetic. No full search-engine benchmark was performed. Benchmark code remains temporary and local; no benchmark files or commits were added to this PR.

Extract the PeptideIndexing optimization from OpenMS#10403.
Keep thread-local merges protected, then sort the complete match vector
once after the parallel region instead of sorting after each merge.
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

looks correct to me

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2dddf1b6-466b-4366-84a5-49c1be64ce57
📥 Commits

Reviewing files that changed from the base of the PR and between fe7b9cc and 9a93e5c.

📒 Files selected for processing (2)
  • CHANGELOG
  • src/openms/source/ANALYSIS/ID/PeptideIndexing.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

PeptideIndexing now sorts accumulated peptide–protein matches once after the parallel search. Thread results and accession mappings are still merged in the critical section. The changelog states that matching results are unchanged.

Changes

PeptideIndexing match sorting

Layer / File(s) Summary
Merge thread hits and sort once
src/openms/source/ANALYSIS/ID/PeptideIndexing.cpp, CHANGELOG
The critical section merges thread hits and accession mappings without sorting. After the parallel region, PeptideIndexing sorts the accumulated hits by the match record’s total order. The changelog states that matching results are unchanged.

Suggested reviewers: cbielow

Priority: ⬇️ Low

Change: Refactor

Merge Risk: ⚪ Minimal · up to 9a93e

Peptide matching retains the ordering used by downstream mapping; no change-specific merge risk is evident.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: sorting PeptideIndexing matches once after the parallel database search.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

A rabbit watched the matches merge
Then waited till the threads were through
One careful sort arranged the hits
Their order stayed the same and true
The rabbit thumped: “All sorted now!”

Comment @coderabbitai help to get the list of available commands.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

1 similar comment
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

@timosachsenberg
timosachsenberg merged commit 48d5060 into OpenMS:develop Oct 8, 2026
11 of 12 checks passed
timosachsenberg pushed a commit that referenced this pull request Oct 8, 2026
Brings in #10448, #10453, #10449 (ProSE -rescore), #10429, #10463, #10455 and
#10452. #10429 is the same PeptideIndexing change this branch carried from
#10403, so the files merged identically; its duplicate CHANGELOG entry is
dropped. The CHANGELOG conflict keeps both sides.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UQCiwdbPoEkrebED8VQ2TJ
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