Skip to content

M3: success-path buffering and defensive-copy allocations (V28 V29) — benchmark-gated, rides #23 #29

Closed

Description

@Blind-Striker

Source: multi-agent review of PR #26, adversarial verification (both PLAUSIBLE — mechanisms real, impact unproven at current volume). 2026-08-14. M-anchor: M3 runway, gated on the performance baselines and executed with (or immediately after) the #23 adapter-boundary redesign — V28 corroborates #23's P3 with the current cursor-list surface.

  • V28 · Successful list responses are fully materialized as UTF-16 strings before System.Text.Json parses them (Pipeline buffers via ReadAsStringAsync; success adapters parse and discard). A success-only UTF-8 path avoids body-size-linear allocation. This is the same mechanism family as M3: union deserialization single-pass redesign + streaming adapter boundary (P1 P5 P3) — benchmark-gated #23/P3 — fold, do not duplicate.
  • V29 · Internally deserialized pages are copied again by the public response's defensive-copy init accessor (DTO collection → Array.AsReadOnly([.. value])), an avoidable O(n) copy when ownership is already internal. Any fix must keep ADR-0004's defensive-copy contract for consumer-constructed instances — the fast path may only apply to the internal already-owned handoff (the forgiven-null error-path precedent shows the emitter can special-case the internal constructor).

Benchmarks decide (repo rule: performance claims are settled by benchmarks, never by argument); before/after numbers ride the PR.

Activity

  1. Blind-Striker commented on Aug 20, 2026

    @Blind-Striker
    CollaboratorAuthor

    Completed by Arc 6 source fa6124d, hosted green in run 32374393085 on Linux, Windows, and macOS. V28 now has a generated success-only UTF-8 byte path, preserving charset/BOM and malformed-UTF-8 replacement fallbacks while leaving API-error RawBody string buffering intact. Same-environment allocation moved GetMessage 21.91 -> 19.15 KB and ListMessages 22.60 -> 19.81 KB; timings improved from 45.970 -> 39.728 us and 46.859 -> 43.593 us respectively. Health stayed effectively flat in allocation (2.08 -> 2.05 KB) and receives no speed claim. V29s defensive-copy premise had already been retired by ADR-0014/#55; the current generated IReadOnly collections remain shallow and uncopied. The Q108 comparison also rejected immutable generated collections on total cost, so PublicApi remains unchanged.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceSpeed / allocation workready-for-agentSpecified enough that the work is mechanical

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions