Skip to content

Modernization Phase 2.0: modules scaffolding + compile-time baselines - #28

Merged
ptesavol merged 2 commits into
mainfrom
modernize/2.0-scaffolding
Jul 3, 2026
Merged

ptesavol merged 2 commits into
mainfrom
modernize/2.0-scaffolding

Conversation

@ptesavol

@ptesavol ptesavol commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Part 2 (C++ modules migration) begins. This phase adds the build scaffolding and — the main deliverable — the baseline numbers every later phase's compile-time claims will be measured against.

Scaffolding

  • cmake/StreamrModules.cmake (canonical, synced to every package by sync-cmake-files.sh — same standalone-publishability policy as the other helpers): Ninja + non-AppleClang guards, CMP0155 NEW, streamr_add_module_library() (STATIC + FILE_SET CXX_MODULES rooted at the package's modules/), streamr_enable_imports() for import-using targets (tests), and the STREAMR_IMPORT_STD opt-in (OFF per the locked decision; requires the CMake-version-specific experimental UUID explicitly). Module scanning stays globally OFF — targets opt in via the helpers, so clangd's compile commands stay clean for all non-migrated code (the exact failure mode that bit us in Phase 1.1).
  • bench.sh: clean / incremental [header] / trace modes measuring the root single-tree build (the workflow modules optimize — all 108 TUs: every test, generated proto, proxyclient). Prints host/compiler/parallelism with each run; trace builds a separate build-bench-trace/ tree (reuses build/vcpkg_installed) and feeds ClangBuildAnalyzer.

Baseline (macOS, Apple Silicon, clang 22.1.8, Debug, Ninja -j10)

Metric Baseline
Clean build (108 TUs) configure 8 s + build 102 s
Incremental: touch StreamID.hpp 10 TUs, 19 s
Incremental: touch SLogger.hpp 48 TUs, 62–70 s
CPU split (-ftime-trace) parse 859 s vs codegen 61 s → 93% parsing

ClangBuildAnalyzer top expensive headers: DhtRpc.pb.h 96 s (33×), gtest.h 84 s (stays #include), SLogger.hpp 81 s (47×), Logger.hpp 66 s (50×), ConnectionManager.hpp 38 s (avg 9.5 s per inclusion), RpcCommunicator.hpp 35 s, Identifiers.hpp 31 s.

The data confirms the migration's premise: >90% of compile CPU is repeated header parsing, and the top of the list is exactly the .pb.h + streamr-header stack the module partitions will wrap. Template-instantiation costs (nlohmann ~22 s, std::format ~13 s, magic_enum ~13 s) are recorded too — modules won't move those, and post-migration numbers should be read with that in mind.

Linux/iOS baselines: to be captured before the Phase 2.4 checkpoint (noted in MODERNIZATION.md).

Next

Phase 2.1: the streamr-eventemitter canary (std-only, concept-heavy, single header) + streamr-json — first real module partitions, export(TARGETS) smoke test, and the clangd-experimental-modules check.

🤖 Generated with Claude Code

ptesavol and others added 2 commits July 3, 2026 12:14
…S baselines

- cmake/StreamrModules.cmake (canonical + synced per-package): Ninja and
  non-AppleClang guards, CMP0155 NEW, streamr_add_module_library() /
  streamr_enable_imports() helpers, STREAMR_IMPORT_STD opt-in (OFF).
  Scanning stays globally OFF; targets opt in via the helpers.
- bench.sh: clean / incremental [header] / trace modes on the root
  single-tree build; trace integrates ClangBuildAnalyzer.
- Baselines recorded in MODERNIZATION.md: clean 8s+102s (108 TUs);
  incremental StreamID.hpp 10 TUs/19s, SLogger.hpp 48 TUs/62-70s;
  93% of compile CPU is frontend parsing; top expensive headers are
  DhtRpc.pb.h, SLogger/Logger.hpp, RpcCommunicator.hpp — the exact
  stack the module partitions wrap.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ptesavol
ptesavol merged commit 87232ee into main Jul 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant