Skip to content

[PERF] S/N estimation without estimator objects: SignalToNoiseOpenMS and PeakPickerHiRes - #10611

Merged
jpfeuffer merged 4 commits into
developfrom
perf/sn-estimation-without-objects
Oct 18, 2026
Merged

jpfeuffer merged 4 commits into
developfrom
perf/sn-estimation-without-objects

Conversation

@timosachsenberg

Copy link
Copy Markdown
Contributor

Split out of #10559 (which is closed in favour of six PRs against develop). The commits are those of #10559, cherry-picked onto develop 89cbde6; only the CHANGELOG entries were moved into a commit of their own. The measurements below were taken in #10559 on the three Orbitrap Astral DIA runs of the ProteoBench entrapment set (32 threads), where #10559 at b84b51e passed the full CI.

What

S/N estimation without estimator objects in the two places OpenSWATH/OpenDIA run it per trace. Values are unchanged.

  • SignalToNoiseOpenMS (from [FIX] rescoring in OpenDIA: 2-3x faster, half the peak memory #10559): keeps only the S/N values of its chromatogram, computed by the new static SignalToNoiseEstimatorMedian::estimate() with the parameters as a plain settings struct, instead of constructing an estimator with its whole parameter set for every chromatogram. Against develop's computeSTN_, all 2,937,203 S/N values of 20,000 random containers and settings are bit-identical.
  • PeakPickerHiRes (new): pick() built a SignalToNoiseEstimatorMedian and set its parameters on every call, also with signal_to_noise 0 (about 430 heap allocations). PeakPickerChromatogram calls it once per trace. The S/N settings are now read once in updateMembers_() and pick() calls estimate(). For that, the settings struct moves out of the class template into SignalToNoiseEstimatorMedianSettings.h (with fromParam()); SignalToNoiseEstimatorMedian<C>::Settings is an alias of it.

Verification of the PeakPickerHiRes change

  • The original and the patched PeakPickerHiRes.cpp, compiled side by side (renamed classes, same estimator headers): bit-identical peaks, FWHM arrays and peak boundaries for 734,400 picks (288 parameter sets x 2,550 chromatograms and profile spectra).
  • PeakPickerHiRes_test (including the S/N 1 and 4 reference outputs) and SignalToNoiseEstimatorMedian_test (with a new section for fromParam()) pass, built against the OpenMS 3.6.0 library with the changed files compiled in. Not run in a full OpenMS build; CI will.
  • pick() with the settings of PeakPickerChromatogram, single thread: 56.8 -> 12.4 µs (150 points), 71.1 -> 22.3 µs (300), 119.4 -> 67.3 µs (1000).

Not changed here

PeakPickerChromatogram never passes its signal_to_noise on to its PeakPickerHiRes: the constructor copies the default 1.0 once and updateMembers_() does not touch it, so OpenDIA's 0.1 only affects border extension and the seeds always use 1.0. Forwarding it changes results, so it is left for a separate decision.

Commits

  • 775118e [PERF,TEST] SignalToNoiseOpenMS: reuse the estimators of a thread
  • ceb023f [PERF,TEST] SignalToNoiseOpenMS: keep only the S/N values, not an estimator
  • 5b044d8 [PERF,TEST] PeakPickerHiRes: estimate S/N without an estimator object per call
  • 2934d2a [DOC] CHANGELOG: sn estimation without objects

Generated by Claude Code

timosachsenberg and others added 4 commits October 17, 2026 10:58
OpenSWATH scoring creates one SignalToNoiseOpenMS per chromatogram of a
transition group, millions in a DIA run. Each constructed a
SignalToNoiseEstimatorMedian, which builds its defaults, copies them, sets
three values and validates the result: 7% of the samples of the scoring
threads were in that parameter handling.

Keep the estimators that are no longer in use in a per-thread pool (at most
64) together with the parameters they were configured with, and take one
from there; it is only reconfigured if the parameters differ. init()
resets everything an estimator keeps from the previous chromatogram.

MRMFeatureAccessOpenMS.cpp holds two SignalToNoiseOpenMS objects with
static storage duration. They are destroyed after the thread-local pool of
the main thread, so the pool is reached through a flag that says whether it
still exists (returning an estimator to a destroyed pool corrupted the heap
at exit in eight TOPP tests of the first version).

Measured with OpenDIA on an Orbitrap Astral DIA run (600k precursors,
32 threads): CPU time of extraction and scoring 37:17 min instead of
38:52 min, wall time 1:33 min instead of 1:35 min. The result table is
unchanged; the new test compares pooled estimators with the values of the
first ones, across chromatograms and parameter sets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…imator

Instead of a per-thread pool of SignalToNoiseEstimatorMedian objects,
SignalToNoiseOpenMS computes the S/N values of its chromatogram with the
new static SignalToNoiseEstimatorMedian::estimate() and keeps only them.
estimate() takes the parameters as a plain Settings struct, so no
parameter set is built or checked per chromatogram; it checks the ranges
of the parameters itself and returns the maximal intensity and the
sparse/rightmost-bin percentages. The body of computeSTN_ moved into it
unchanged apart from the names, and computeSTN_ now calls it, so the
estimator class behaves as before. The pool, its thread-local storage and
the guard for objects destroyed after it are gone.

GaussianEstimate estimate_() of SignalToNoiseEstimator is static now; it
uses no member.

Checked against develop's computeSTN_ (copied verbatim) on 20,000 random
containers and settings in all three auto modes: all 2,937,203 S/N
values, the maximal intensities and the statistics are bit-identical
(GCC -O0/-O2, Clang -O2). New test sections compare SignalToNoiseOpenMS
and estimate() with a configured estimator.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Sr8hFGChVGwX29y7mDXezS
… per call

pick() built a SignalToNoiseEstimatorMedian and set its parameters
(param_.copy("SignalToNoise:") + setParameters) on every call, also with
signal_to_noise 0. That is about 430 heap allocations and, on chromatograms
of 150-300 points, more time than the picking itself. PeakPickerChromatogram
calls it once per trace, so OpenSWATH and OpenDIA paid it for every fragment
trace they pick.

The S/N settings are now read once in updateMembers_() and pick() calls the
static SignalToNoiseEstimatorMedian::estimate(). For that, the Settings struct
moves out of the class template into SignalToNoiseEstimatorMedianSettings.h
(it does not depend on the container type, and PeakPickerHiRes.h can hold it
without including the estimator), with fromParam() reading a parameter set
like updateMembers_() does. SignalToNoiseEstimatorMedian<C>::Settings is an
alias of it, so existing code is unchanged.

Output is unchanged: the original and the patched PeakPickerHiRes, compiled
side by side, give bit-identical peaks, FWHM arrays and boundaries for
734,400 picks (288 parameter sets x 2,550 chromatograms and profile spectra).
pick() with the settings of PeakPickerChromatogram: 56.8 -> 12.4 us
(150 points), 71.1 -> 22.3 us (300), 119.4 -> 67.3 us (1000).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YEL28EKUFAAs9SNwbVEV9s
@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1102afb7-9397-40f4-a7c9-3bcb88db5e9c
📥 Commits

Reviewing files that changed from the base of the PR and between 89cbde6 and 2934d2a.

📒 Files selected for processing: 10
  • CHANGELOG
  • src/openms/include/OpenMS/ANALYSIS/OPENSWATH/DATAACCESS/MRMFeatureAccessOpenMS.h
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerHiRes.h
  • src/openms/include/OpenMS/PROCESSING/NOISEESTIMATION/SignalToNoiseEstimator.h
  • src/openms/include/OpenMS/PROCESSING/NOISEESTIMATION/SignalToNoiseEstimatorMedian.h
  • src/openms/include/OpenMS/PROCESSING/NOISEESTIMATION/SignalToNoiseEstimatorMedianSettings.h
  • src/openms/include/OpenMS/PROCESSING/NOISEESTIMATION/sources.cmake
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerHiRes.cpp
  • src/tests/class_tests/openms/source/MRMFeatureAccessOpenMS_test.cpp
  • src/tests/class_tests/openms/source/SignalToNoiseEstimatorMedian_test.cpp
  • Autofix · 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

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

@timosachsenberg timosachsenberg left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2934d2af for substantive issues. No actionable regressions found in the S/N refactor. I checked the settings/default mapping, estimator state updates, and PeakPickerHiRes call sites; the arithmetic and indexing are preserved for supported inputs.

Build and Test and the pyOpenMS wheel workflow passed on this head. This was a static review; I did not rerun the tests or benchmarks locally.

@jpfeuffer
jpfeuffer merged commit 48d4c96 into develop Oct 18, 2026
33 checks passed
@jpfeuffer
jpfeuffer deleted the perf/sn-estimation-without-objects branch October 18, 2026 17:17
timosachsenberg pushed a commit that referenced this pull request Oct 19, 2026
…#10301, #10611, #10606, #10608, #10609, #10617, #10610, #10578 ProSE Percolator rescoring, #10628)

Only CHANGELOG conflicted; both entries are kept. Develop's changes to FalseDiscoveryRate,
IDScoreGetterSetter, ConsensusMapMergerAlgorithm, FileInfo and ProSE work on the established
classes, which this branch keeps as they are.

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

3 participants