Skip to content

perf: release redundant field completion metadata - #90

Merged
Kinfe123 merged 1 commit into
mainfrom
perf/prune-completed-field-metadata
Oct 29, 2026
Merged

Kinfe123 merged 1 commit into
mainfrom
perf/prune-completed-field-metadata

Conversation

@Kinfe123

@Kinfe123 Kinfe123 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Streamfold kept completion records for every descendant after its JSON container completed. Drop those redundant records when marking a field complete: the parent completion flag already answers descendant queries, while replacing the field still invalidates its completion state.

Adds contracts for completed nested containers while siblings stream, array-index aliases, duplicate-key replacements, special keys, negative replacement numbers, and immutable snapshot history. Adds a reproducible retained-heap benchmark without exposing parser internals.

Validation:

  • All six GitHub CI jobs passed, including Chromium, Firefox, WebKit, Node 20 core tests, and the Assistant UI demo.
  • pnpm check: 178 JavaScript tests and 11 Rust tests, plus type, syntax, Rust formatting, and clippy checks.
  • Chromium smoke test, package dry-run, and frozen-lockfile installation passed.
  • pnpm bench, pnpm bench:sdk, and snapshot A/B validation against 0.1.14 passed; the snapshot comparison asserts every partial value. No CPU speedup is claimed.
  • Memory benchmark compares published 0.1.14 with this change in fresh Node 24.21.0 processes on Apple M1: three alternating trials, eight warmups, explicit GC, 16 active streams, 2,000 nested records per stream, 217,801-byte prefixes, 4,096-character chunks.
  • Immutable mode retained JavaScript heap: 92.36 MiB → 18.83 MiB while the array is open; 92.34 MiB → 10.99 MiB once the root completes. Live mode shows the same reduction. The values and field states are asserted in each run.
  • Run pnpm bench:completion-memory /path/to/streamfold-0.1.14/src/index.js to reproduce.

These are synthetic JavaScript heap measurements, excluding WASM linear memory; this PR makes no production latency claim. The runtime change is internal and does not change the public API.

@Kinfe123
Kinfe123 merged commit 412b38f into main Oct 29, 2026
6 checks passed
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