Skip to content

30-40% faster build, plus small runtime improvement - #9648

Merged
timosachsenberg merged 11 commits into
OpenMS:developfrom
cbielow:header_opt
Jun 23, 2026
Merged

timosachsenberg merged 11 commits into
OpenMS:developfrom
cbielow:header_opt

Conversation

@cbielow

@cbielow cbielow commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

originally set out to optmize includes, but found Boost::spitit::qi/karma to be a compile-time burden, as well as being superseded by modern C++ char_conv (faster).
In practice, getting rid of it, yields:

Linux (GCC 12.2):

Metric Baseline (develop, Boost.Spirit) Optimized (current, charconv) Improvement
Wall time 5m 40s 3m 50s 32% faster
CPU time 415m 18s 235m 16s 43% less
Object file size 275 MB 176 MB 36% smaller

MSVC VS2022:

Metric Baseline (develop, Boost.Spirit) Optimized (current, charconv) Improvement
Wall time 00:27:39 00:13:42 50% faster
Object file size 1.33 GB 1.2 GB 10% smaller

Reading/writing idXML, for example, is slightly faster now (4%).

Could probably be optmized further, since we are currently mimicking a lot of Boost::spirit behaviour when converting.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

How can I get additional information on failed tests during CI

Click to expand If your PR is failing you can check out

Advanced commands (admins / reviewer only)

Click to expand
  • /reformat (experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.
  • setting the label "NoJenkins" will skip tests for this PR on jenkins (saves resources e.g., on edits that do not affect tests)
  • commenting with rebuild jenkins will retrigger Jenkins-based CI builds

⚠️ Note: Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are performed).

cbielow added 8 commits June 18, 2026 11:53
Remove unnecessary #include directives from widely-included headers
to reduce transitive include chains and compile times.

Phase 1 - CONCEPT folder:
- Remove StringUtils.h (Boost.Spirit/Karma chain) from UniqueIdInterface.h,
  StreamHandler.h, VersionInfo.h
- Remove unused Param.h from UniqueIdGenerator.h
- Remove unused <string>/<cstring> from Macros.h
- Add missing includes to EnumHelpers.h (was broken by accident)
- Remove redundant StringUtils.h from FuzzyStringComparator.h

Phase 2 - DATASTRUCTURES/METADATA/KERNEL/FORMAT/ANALYSIS:
- Create TypeAliases.h with StringList/IntList/DoubleList typedefs
- Update DataValue.h, FuzzyStringComparator.h, SpectrumSettings.h to
  use TypeAliases.h instead of full ListUtils.h
- Remove unused FeatureMap.h from MassTrace.h
- Remove unused MRMFeature.h/Feature.h/FeatureMap.h from MRMFeatureQC.h
- Remove 5 unused includes from MetaboliteSpectralMatching.h
- Remove StringUtils.h from XMLFile.h, ProteinHit.h, DataFilters.h,
  LinearRegression.h, MzCalibration.h
- Remove unused ListUtils.h from PosteriorErrorProbabilityModel.h
- Fix missing includes (UnimodXMLFile.h, DeconvolvedSpectrum.cpp)

Fixes missing transitive includes in .cpp files where needed.
Switch 38 headers that only use StringList/IntList/DoubleList typedefs
from including the heavy ListUtils.h (which pulls in StringUtils.h ->
Boost.Spirit/Karma) to the lightweight TypeAliases.h.

Affected modules: METADATA, FORMAT, CHEMISTRY, ANALYSIS, PROCESSING,
QC, COMPARISON, FEATUREFINDER, APPLICATIONS, DATASTRUCTURES.

Added #include <OpenMS/DATASTRUCTURES/ListUtils.h> to 22 .cpp files
that use ListUtils:: functions and were previously getting the include
transitively through headers.
Remove #include <OpenMS/CONCEPT/Exception.h> from 18 headers that
never reference Exception:: types. The include was unnecessary and
added transitive dependencies to the Types.h/Config.h chain.

Added OpenMSConfig.h to LinearRegressionWithoutIntercept.h which
needs OPENMS_DLLAPI but previously got it transitively via Exception.h.
@cbielow
cbielow requested a review from timosachsenberg June 22, 2026 13:33
@timosachsenberg

Copy link
Copy Markdown
Contributor

Awesome! Love it. Let's see what conversion says. I think I once tried it and I ran into numeric differences on arm etc.

@jpfeuffer

jpfeuffer commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

@cbielow

cbielow commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

fast_float worth the (header-only) dependency?

https://github.com/fastfloat/fast_float

thought about it, but decided 'no' since it's a libc++ problem, so just MacOS clang is affected by default.

@jpfeuffer

Copy link
Copy Markdown
Contributor

true. If it was only that, I would immediately agree. But you might get additional speedups on the other platforms.
But fine for me. Won't be much.

@cbielow
cbielow enabled auto-merge (squash) June 22, 2026 18:19
@cbielow

cbielow commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Test pass :-)

@timosachsenberg timosachsenberg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@timosachsenberg
timosachsenberg disabled auto-merge June 23, 2026 04:47
@timosachsenberg
timosachsenberg merged commit e6fcc89 into OpenMS:develop Jun 23, 2026
38 checks passed
timosachsenberg added a commit that referenced this pull request Jun 24, 2026
…9650, #9651 (#9652)

- Add PR reference (#9650) to the error-message improvement entry (was issue #9636 only)
- Add PR reference (#9642) to ProSE end-of-search report entry
- Add PR reference (#9643) to PSMFeatureExtractor andes support entry
- Add PR reference (#9649) to UniPEFF new-tool entry
- Add Build System entry for #9648: Boost.Spirit → charconv, 30-40% faster build
- Add Build System entry for #9651: missing <thread> header fix for clang 21+


Claude-Session: https://claude.ai/code/session_01DdyZmN6J65umScGRherQ9W

Co-authored-by: Claude <[email protected]>
@jonasscheid jonasscheid mentioned this pull request Oct 13, 2026
4 tasks done
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