I built this after hitting GC stalls parsing streaming tool calls in my AI agent.
LLM outputs are getting large — code edits, file writes, 50-200KB JSON payloads.
Every AI SDK I looked at (Vercel, Anthropic, TanStack, OpenClaw) does `buffer += chunk; JSON.parse(buffer)` on every token.
That's O(n²) — a 100KB tool call arrives in ~8000 chunks, and each chunk re-parses the entire accumulated buffer from scratch.
The cumulative parse time adds up to 13.4 seconds for the Anthropic SDK.
Each intermediate buffer string and parsed object becomes garbage immediately,
thousands of short-lived allocations that put constant pressure on the GC.
VectorJSON scans only the new bytes on each chunk. O(n) total — same payload, 6.6ms.
Parsing happens in WASM linear memory, so no JS objects are created until you access a field.
Built on zimdjson (Zig port of simdjson by @travisstaloch) compiled to WASM.
Fields materialize lazily through a Proxy — if you only read 3 fields from a 100KB payload, the other 97% never touches the JS heap.
Deep comparison runs entirely in WASM memory — 2-4× faster than recursive JS deepEqual with 24× less heap pressure.
Not a replacement for JSON.parse — for single-shot full materialization, JSON.parse is faster (it's optimized C++ in V8).
VectorJSON is built for streaming, partial access, and deep comparison.
teamchong•1h ago
Every AI SDK I looked at (Vercel, Anthropic, TanStack, OpenClaw) does `buffer += chunk; JSON.parse(buffer)` on every token. That's O(n²) — a 100KB tool call arrives in ~8000 chunks, and each chunk re-parses the entire accumulated buffer from scratch. The cumulative parse time adds up to 13.4 seconds for the Anthropic SDK. Each intermediate buffer string and parsed object becomes garbage immediately, thousands of short-lived allocations that put constant pressure on the GC.
VectorJSON scans only the new bytes on each chunk. O(n) total — same payload, 6.6ms. Parsing happens in WASM linear memory, so no JS objects are created until you access a field.
Built on zimdjson (Zig port of simdjson by @travisstaloch) compiled to WASM. Fields materialize lazily through a Proxy — if you only read 3 fields from a 100KB payload, the other 97% never touches the JS heap. Deep comparison runs entirely in WASM memory — 2-4× faster than recursive JS deepEqual with 24× less heap pressure.
Not a replacement for JSON.parse — for single-shot full materialization, JSON.parse is faster (it's optimized C++ in V8). VectorJSON is built for streaming, partial access, and deep comparison.