Repository navigation
perf(BrukerTimsFile): use boost::unordered_flat_map in FrameAggregator - #9243
Conversation
Swap std::unordered_map for boost::unordered_flat_map (Boost 1.81+ API,
already required) in the three hot maps inside FrameAggregator: grid_,
denoised, smoothed. Open-addressing eliminates per-node allocations and
pointer-chasing, which dominated profile time across the DIA/DDA MS1
and DIA MS2 aggregation+centroiding paths.
Measured on a single ~344 MB DIA-PASEF .d (8 window groups, 24 windows,
2823 MS2 frames) running BrukerTimsFile_test directly:
Picker (FrameAggregator::finalize / finalizeCentroided), per call:
finalize 31.1 s -> 14.5 s (2.1x)
finalizeCentroided (denoised) 75.8 s -> 25.5 s (3.0x)
finalizeCentroided (no-denoise) 222.9 s -> 69.8 s (3.2x)
End-to-end test wall: 2189 s -> 1802 s (-17.7%)
Includes denoised.reserve()/smoothed.reserve() in finalizeCentroided
to avoid rehash cascades while filling the per-call temporaries.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
Added entries for: - Perf: BrukerTimsFile FrameAggregator boost::unordered_flat_map (#9243) - Native .featureparquet and .consensusparquet formats (#9242) - IsobaricWorkflow: .idparquet and .mzId input support (#9241) - IDMerger: fix preserved input file order (#9240) - PercolatorAdapter: fix in-process post-filter (#9240) - IDRipper: .idparquet input/output support (#9237) - ProteomicsLFQ: .idparquet and .mzId input support (#9236) - FileTypes::FEATUREPARQUET, FileTypes::CONSENSUSPARQUET in Library section (#9242) Co-authored-by: GitHub Copilot <[email protected]> Co-authored-by: Copilot <[email protected]>
Added entries for: - IDRipper .idparquet input/output support (#9237) - FEATUREPARQUET and CONSENSUSPARQUET file types (#9242) - BrukerTimsFile FrameAggregator perf improvement with boost::unordered_flat_map (#9243) - PercolatorAdapter: fix post-filters on in-process backend (#9240) - IDMerger: fix input file order preservation (#9240) - ProteomicsLFQ: .idparquet/.mzId input support (#9236) - IsobaricWorkflow: .idparquet/.mzId input support (#9241) - wnetalign/wnet/pylmcf FetchContent dependencies (#8992) - OpenMS Library: FileTypes::FEATUREPARQUET/CONSENSUSPARQUET (#9242) - OpenMS Library: FeatureGroupingAlgorithmWNet and WNetMatcher (#8992) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]> Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: timosachsenberg <[email protected]>
Summary
std::unordered_mapforboost::unordered_flat_map(Boost 1.81+, already required) inFrameAggregator's three hot maps:grid_,denoised,smoothed.finalize/finalizeCentroided).reserve()for the per-calldenoised/smoothedtemporaries to avoid rehash cascades.Measured impact
Single run of
BrukerTimsFile_testdirectly (withENABLE_OPENTIMS_TESTS=ON), DIA test data (8 window groups × 24 windows × 2823 MS2 frames, 50 M raw MS2 peaks):Picker time (chrono-measured, summed across all 8469 calls per load):
std::unordered_mapboost::unordered_flat_mapfinalize(denoise only)finalizeCentroided(denoised, min_support=1)finalizeCentroided(no-denoise, min_support=0)Section + total wall time:
DDA MS1 aggregation also goes through
FrameAggregatorand benefits, but per-section variance was too high in this single run to quote a clean number.Why this works
FrameAggregator::grid_keys onuint64_twith a 16-byteCellvalue; the picker walks every cell doing 5×5 neighbor lookups (~40 hash probes per cell during smoothing + local-max + centroid). Withstd::unordered_map's node-per-entry layout, each probe touches a fresh cache line. Open-addressing keeps keys + values contiguous and SIMD-friendly.API compatibility
boost::unordered_flat_mapis API-compatible withstd::unordered_mapfor the operations this code uses:operator[],find,count,end, range-for over[key, value],reserve,clear,size. No call sites needed changes.Numerical equivalence
for (const auto& [key, val] : map)walks entries in different order betweenstd::unordered_mapandboost::unordered_flat_map. The picker code sums doubles, so individual cell intensities can differ by ≤1 ULP from rehash. This was already the case across libstdc++ vs libc++ vs different Boost versions — the test asserts on counts and ratios, not bit-exact m/z, and continues to pass.Test plan
BrukerTimsFile_testpasses locally withENABLE_OPENTIMS_TESTS=ON🤖 Generated with Claude Code
Summary by CodeRabbit