Skip to content

Implement stable SegmentedSequence - #443

Merged
helly25 merged 18 commits into
mainfrom
feature/segmented-sequence
Sep 23, 2026
Merged

helly25 merged 18 commits into
mainfrom
feature/segmented-sequence

Conversation

@helly25

@helly25 helly25 commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Implement SegmentedSequence as a standalone C++23 container on current main, with only the
shared BlockSource foundation and reproducible benchmark tooling it needs. This removes the former
dependency on the Arena and string-interning stack so the container can be reviewed and merged
independently.

The implementation now establishes valid array storage on every source/reuse path, exposes the
promised C++23 range surface, rolls failed growth back structurally, and records the actual build
context behind new benchmark evidence.

AG;DR

  • Rebases the original Implement stable SegmentedSequence #443 work onto main, carries the relevant STYLE_CPP.md guidance and
    SegmentedSequence design from Define production string interning architecture #438, and carries Add reproducible benchmark JSON artifacts #439's benchmark-artifact work. The additive
    category integrity rule formerly stacked in Add reproducible benchmark JSON artifacts #439 is now supplied by merged prerequisite Allow additive coverage categories on main #534.
  • Extracts mbo/memory/block_source.h, its tests, and a focused build target from the old Arena
    parent because SegmentedSequence directly consumes that storage contract. The Arena itself is in
    follow-up Implement raw byte Arena and validate layouts #532.
  • Establishes segment T[] storage/provenance by restarting std::byte[] lifetime on every fresh
    or recycled block, without laundering a non-live T; individual elements begin lifetime only
    through construct_at.
  • Restricts T to complete cv-unqualified non-array object types with non-throwing destruction and
    caps max_size() by options, iterator difference_type, and byte representation.
  • Provides conditional requirement-policy noexcept for at, front, back, pop_back, and
    pop_back_value, with compile-time and runtime exception-policy coverage.
  • Adds iterator-pair, std::from_range_t, and append_range ingestion for sized, single-pass,
    move-only, self-aliased, default-source, and source-supplied cases. Mutable/const iterator
    interoperability is checked against the standard concepts.
  • Restores size, segment count, and capacity after resize/range construction failure. The docs and
    tests state the vector-like caveat that a throwing constructor fed an aliased rvalue may still
    leave the source element moved from even though structure rolls back.
  • Tests fixed, inline, allocator-backed, reused, misaligned, exact-size, and over-aligned storage;
    lifetime/destruction; allocation and construction rollback; capacity bounds; iterator behavior;
    and requirement-policy failures. BlockSource assertions follow current Optional matcher style.
  • Keeps the intentional placement-array lifetime restart and throwing-move regression explicit to
    clang-tidy while satisfying the rest of the C++23 ownership, special-member, const-correctness,
    named-parameter, and cast checks.
  • Uses an intentionally user-provided noexcept(false) destructor in the negative element-concept
    fixture so GCC and Clang agree that the test type is not nothrow-destructible.
  • Makes the design document describe current v1 behavior, including retained tail segments,
    source-specific runtime exhaustion, custom PMR copy behavior, and the absence of a real constexpr
    storage path. Deferred pooling, hybrid growth, compaction, and policy experiments are explicit.
  • Requires C++23 in the benchmark and records compiler name/version/extra/build, actual
    __cplusplus, requested dialect, standard library, Apple SDK/deployment context, and parsed Bazel
    release. Explicit Bazel overrides cannot contradict the running executable.
  • Keeps schema-v1 historical C++20 artifacts readable and validates that compatibility with a
    dedicated regression test.
  • Adds a focused memory coverage category for the BlockSource foundation without changing any
    existing category baseline.

Validation performed locally on the reviewed tree:

  • bazel test //mbo/memory:block_source_test //mbo/container:segmented_sequence_test //mbo/container:segmented_sequence_require_exceptions_test
  • bazel test --//mbo/config:require_throws=true //mbo/container:segmented_sequence_require_exceptions_test
  • python3 -m unittest tools/benchmark_artifact_test.py
  • production coverage: 136/137 tests passed with one expected skip; supplemental exception
    coverage: 3/3 passed
  • measured new memory category: 96.67% lines, 95.65% functions, 96.77% branches
  • focused tests, all non-clang-tidy pre-commit hooks, and clang-tidy for the benchmark, normal test,
    and exception-policy test translation units passed; the full compiler/sanitizer matrix remains
    CI-owned
  • authoritative current-base CI run 35913147129 passed coverage integrity, coverage, clang-tidy,
    GCC 15, Clang 22, ASan, every BCR cell, and aggregate done after retrying a transient macOS
    restored-cache cleanup race

The committed baseline preserves all existing authoritative Linux measurements and adds only the
new locally measured memory row; CI remains authoritative for platform stability.

Portability: the branch targets the repository's GCC 15 / Clang 22 C++23 baseline. The committed
historical measurement artifact remains immutable evidence from its recorded C++20 source revision
and toolchain.

@helly25
helly25 force-pushed the feature/segmented-sequence branch from 85f942f to 853a483 Compare September 10, 2026 21:24
@helly25
helly25 force-pushed the feature/segmented-sequence branch from 45d6fcb to 70beb7c Compare September 22, 2026 22:08
@helly25
helly25 changed the base branch from feature/arena to main September 22, 2026 22:08
@helly25
helly25 force-pushed the feature/segmented-sequence branch from 09ed57d to bbc5112 Compare September 23, 2026 11:40
@helly25
helly25 marked this pull request as ready for review September 23, 2026 18:13
@helly25
helly25 requested a review from Fab-Cat September 23, 2026 18:13
@helly25
helly25 force-pushed the feature/segmented-sequence branch from d20d0e6 to 9c83fc3 Compare September 23, 2026 20:01
@helly25
helly25 merged commit 12bf51f into main Sep 23, 2026
28 of 31 checks passed
@helly25
helly25 deleted the feature/segmented-sequence branch September 23, 2026 20:49

This branch was successfully deployed

1 active deployment
github-pages 9c83fc30 Deployed Sep 23, 2026 by helly25 via publish #835
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.

1 participant