Skip to content

refactor: decouple serialization#534

Open
Becheler wants to merge 1 commit into
boostorg:developfrom
Becheler:refactor/decouple-serialization
Open

refactor: decouple serialization#534
Becheler wants to merge 1 commit into
boostorg:developfrom
Becheler:refactor/decouple-serialization

Conversation

@Becheler

Copy link
Copy Markdown
Collaborator

Remove dependency to Boost.Serialization

Before submitting

  • This PR targets the develop branch.
  • I searched for an existing PR or issue covering the same change.
  • My contribution is licensed under the Boost Software License 1.0.

Type of change

  • Bug fix
  • New feature or API addition
  • Refactor (no behavior change)
  • Documentation
  • Build, CI, or tooling
  • Other (specify below)

Does this PR introduce a breaking change?

  • Yes (describe migration impact below)
  • No

What this PR does

  • Phase out of serialization nvp utilities to boost.core.serialization
  • Use a forward declaration trick to decouple BGL from Serialization.

Motivation

Boost.Serialization is one of the heaviest Boost.Library along with Spirit: 22 direct dependencies, 55 total, effectively dragging most of Boost in default build: https://alandefreitas.github.io/boostdep_graph/libs/serialization.html

In contrast, Boost.Core.Serialization has 3 dependencies: https://alandefreitas.github.io/boostdep_graph/libs/core.html

We switch to Boost.Core.Serialization dependencies and use a forward declaration trick inspired by Peter Dimov uuid trick to remove direct coupling on Boost.Serialization (the user who needs Serialization will pull its headers anyway): https://github.com/boostorg/uuid/blob/2aa25a3afe023c5324d1b13015a65f67bfaef08c/include/boost/uuid/uuid.hpp#L344-L357

Some Serialization stuff for property map is behind an MPI guard: this is actually Boost.Parallel territory, and looks like a remnant of modularization BGL/PBGL. This should be exported to PBGL rather than polluting BGL, but it's a cross-repo PR and outside of the current scope.

Testing

The current test is unchanged, we just add a static assertion to verify the tracking level is unchanged (it exists to guarantee that non-const graphs can be serialized, removing it would cause a compilation error deep inside Serialization if the user tries to serialize a non-const graph).

Checklist

  • Existing tests pass (b2 in the test/ directory).
  • New behavior is covered by a test, or this is a docs / build / refactor change.
  • Documentation was updated if user-facing behavior changed.
  • No new compiler warnings on the platforms I built against.

@Becheler Becheler self-assigned this Jul 20, 2026
@Becheler Becheler added the technical debt Code that works but needs refactoring, cleanup, or modernization. Not user-facing. label Jul 20, 2026
@github-actions

Copy link
Copy Markdown

Boost dependency footprint vs develop (auto-generated).
PR run 29729661107 vs develop run 29726826217 (e6ba37cdd4).

Header-inclusion weights (graph files pulling each direct dependency in):

Dependency develop PR Δ
serialization 2 1 -1
type_traits 40 41 +1
core 13 15 +2

Transitive Boost modules: 69 → 69 (0)

@Becheler
Becheler marked this pull request as ready for review July 20, 2026 09:53
@Becheler
Becheler requested a review from jeremy-murphy as a code owner July 20, 2026 09:53
@github-actions

Copy link
Copy Markdown

Compiler-warning counts vs develop (auto-generated).
PR run 29729661111 vs develop run 29726826190 (e6ba37cdd4).

Job Baseline After Delta
macos (clang, 14) 4 4 0
macos (clang, 17) 4 4 0
macos (clang, 20) 4 4 0
ubuntu (clang-19, 14) 4 4 0
ubuntu (clang-19, 17) 4 4 0
ubuntu (clang-19, 20) 4 4 0
ubuntu (clang-19, 23) 4 4 0
ubuntu (gcc-14, 14) 10 10 0
ubuntu (gcc-14, 17) 10 10 0
ubuntu (gcc-14, 20) 10 10 0
ubuntu (gcc-14, 23) 10 10 0
windows_msvc_14_3 (msvc-14.3) 971 971 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

technical debt Code that works but needs refactoring, cleanup, or modernization. Not user-facing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant