Skip to content

perf(evidence): fuse streamed JSON token handling - #1694

Merged
N0zoM1z0 merged 2 commits into
mainfrom
fix/evidence-json-stream-allocation
Oct 11, 2026
Merged

N0zoM1z0 merged 2 commits into
mainfrom
fix/evidence-json-stream-allocation

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Large evidence JSON files currently create async iterator and stream work for every parser token. On an 18.54 MB snapshot exported from a real Ghidra analysis, that work dominates the sampled allocation window.

Fuse the upstream parser, scalar packing, heap admission, and upstream value assembler into synchronous token stages. File reads remain asynchronous and cancellation-aware. Keep the existing capacity estimates, UTF-8 validation, scalar limits, file identity checks, and typed failures. Declare the existing stream-chain 4.2.6 as a direct runtime dependency. Add a public CLI container-expansion regression plus a same-process successful read after rejection.

Validation:

  • Final head 0efc3a3d passed 30 focused tests, including malformed input, cancellation, long strings, the existing 512 MiB whitespace control, and the new container admission/recovery case. check:fast, Knip, and whole-repository formatting passed on the final head. A real-evidence Linux CLI/MCP replay also passed on the benchmarked candidate; its reader source and compiled file are byte-identical to the final head.
  • Actual Flameox 0.2.9 ran five paired blocks under two CPUs and a 768 MiB Node heap. All ten workloads passed a separate oracle checking the complete canonical snapshot digest and retained Evidence identity. Median paired wall-time difference: −3.63 s; separate baseline/candidate medians: 7.64 / 3.62 s. The workload includes Node startup, production snapshot reading/validation, full canonical hashing, and exit. Flameox classifies this as a descriptive practical improvement; these are local measurements, not a universal latency guarantee.
  • Scoped V8 sampling of production snapshot reading, analyzed with Flameox, estimated cumulative allocations of 10.77 / 3.17 GB before/after (single capture each). This includes collected objects and excludes module initialization; it is not peak RSS or a leak measurement.
  • Integrated perf(domain): reuse canonical JSON key encodings #1687 and perf(mcp): keep Playwright and type-only imports off MCP startup #1691 without changing the measured reader source or compiled file. Final-head CI run 38110917770 passed 31/31 jobs, including Windows package verification.
  • Actual Windows Node 22.19 / SDK 2.3.1 verification passed with the full source-built 6.4.0 archive, standard CLI/MCP entrypoints, existing matching locked production dependencies, and same-head CI native controls. A fresh real Ghidra 12.1.4 analysis saved a current-profile snapshot; adding 9 MiB of JSON whitespace forced streaming. Restarted MCP, verified the old reference was unavailable before import, restored exact retained Evidence/view identity, and checked CLI/MCP summary parity. JVM 512 MiB / Node heap 768 MiB / two CPUs; target unchanged, temporary directories empty, no remaining observed owned descendants. This is source-built package acceptance, not a published npm release or Windows large-payload benchmark.

The larger 83 MB native snapshot capacity case from #1680 is not established as fixed by the 18.54 MB measurements. Keep that issue open.

Refs #1065, #1680.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T04:14:33.621119Z 9d57542 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@N0zoM1z0 N0zoM1z0 added performance Performance regressions, scaling limits, and bounded-resource work P2: medium Medium priority issue labels Oct 11, 2026
@N0zoM1z0 N0zoM1z0 added the area: evidence Evidence, artifacts, and reconstruction label Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction P2: medium Medium priority issue performance Performance regressions, scaling limits, and bounded-resource work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant