Skip to content

perf(domain): reuse canonical JSON key encodings - #1687

Merged
N0zoM1z0 merged 1 commit into
mainfrom
perf/flameox-hotspots-20261011
Oct 11, 2026
Merged

N0zoM1z0 merged 1 commit into
mainfrom
perf/flameox-hotspots-20261011

Conversation

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Canonical hashing is a measurable REA-owned hotspot in an actual small-target CLI CPU profile. Repeated graph keys were JSON-encoded for every object and each member allocated a temporary value frame. This change reuses exact key encodings within one existing 8,192-code-unit buffer quantum and processes member values directly. Fallback encoding, canonical bytes, cooperative yields and complete results remain available.

It also repairs a reproduced domain error: when a pending property is deleted during a cooperative pause, its object frame was discarded and later properties were omitted from the digest. The iterator now resumes that object. This is a domain-continuation reproduction; normal sealed application graphs are immutable.

Refs #1065. Existing #904/#994 already solved per-fragment crypto-update crossings; this follow-up addresses key encoding and iterator allocation in the newer cooperative digest. No currently open overlapping digest PR was found with gh before publication.

Validation uses pinned Flameox 0.2.9, Node 24.18.0/npm 11.16.0, Linux, CPUs 13/15 and nice 10. One local heavy lane runs at a time, with a 768 MiB outer Node heap, 2 GiB family RSS guard, 2 GiB host reserve and 90-second per-command guard. The target JavaScript is analyzed statically and never executed.

  • Real public CLI CPU and V8 sampling-heap captures: a 29,458-byte owned JavaScript source, complete CLI output. The initial CPU capture contains 2,919 exported samples, including 113 self samples in canonicalJsonDigestSteps. Profiles guide this experiment; they are not speedup percentages or source-analyzer-child attribution.
  • Flameox randomized paired digest experiment: seven blocks, two cases, seed 20261011, 12 digest iterations after two warmups per process, the same complete normalized application result. All 14 semantic oracles pass. Capture-process medians are 1,184.00 ms baseline and 943.54 ms candidate (about 20% lower). Paired median difference is -222.62 ms, bootstrap 95% interval [-250.01, -216.98] ms. This is local digest-workload evidence, not full CLI speedup or model token billing.
  • Structural control of that complete result: JSON encoding calls 339,896 -> 138,335; temporary member value frames 215,137 -> 0; both retain exactly 736 cooperative yields and the same complete canonical SHA-256. Large-key continuations still use their necessary frames.
  • Separate full CLI experiment: five randomized paired blocks, all ten complete-result/Evidence-ID/input/progress-byte oracles pass. Paired median difference -63.07 ms with 95% interval [-1,964.56, +329.03] ms. This does not establish end-to-end acceleration; whole-analysis timing remains noisy.
  • Real compiled public CLI and pinned-SDK stdio MCP: a 6,686-byte source before/after control retains the entire normalized result and Evidence ID, text/structured parity, unchanged source and a subsequent successful ping. The larger target reaches the existing typed MCP receive-buffer constraint; its complete analysis remains retained and the connection still pings. No result truncation or transport-budget change is introduced.
  • 81 related tests across eight files pass, including canonicalization property checks, escaped/long/supplementary Unicode keys, cache overflow, repeated references, cancellation/abandonment, sparse arrays, nonfinite numbers/cycles, complete large literals, prior Evidence retention and subsequent MCP work. All eight static/documentation/architecture/discovery checks pass. Fresh six-step build/metadata and final committed-source public controls pass.

Local target/profile/experiment receipts live in /tmp/rea-flameox-performance-20261011; generated runtime, catalog and temporary tool environment are excluded from the commit. No real Hopper/Ghidra, browser, Electron target runtime, full Notion/Obsidian, or previously failing full Bun-directory behavior is claimed. Final-source CI is pending.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@N0zoM1z0
N0zoM1z0 merged commit 89ea2ca into main Oct 11, 2026
31 checks passed
@N0zoM1z0
N0zoM1z0 deleted the perf/flameox-hotspots-20261011 branch October 11, 2026 03:40
@morluto morluto added performance Performance regressions, scaling limits, and bounded-resource work area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added the area: domain Domain logic, errors, and pure functions label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior performance Performance regressions, scaling limits, and bounded-resource work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants