An Expensive Language Boundary
At Reco, they have a policy engine that evaluates JSONata expressions against every message in their data pipeline—billions of events, on thousands of distinct expressions.
The reference implementation is JavaScript, whereas their pipeline is in Go. For years they've been running a fleet of jsonata-js pods on Kubernetes—Node.js processes that Go services call over RPC. For every event, they had to serialize, send over the network, evaluate, serialize the result, and send it back.
This was costing them ~$300K/year in compute. One larger cluster had scaled to over 200 replicas just for JSONata expressions, resulting in Kubernetes troubles (like reaching IP allocation limits).
The RPC latency overhead was ~150 microseconds before any evaluation even starts. For a simple field lookup that should take nanoseconds—they were paying microseconds.
Building gnata
They used the same approach as Cloudflare's vinext rewrite: port the official jsonata-js test suite to Go, then implement the evaluator until every test passes.
A few iterations and some 7 hours later—13,000 lines of Go with 1,778 passing test cases. Total token cost: $400.
Production cost for jsonata-js in the previous month was about $25K—now it was 0.
Two-Tier Evaluation Architecture
At compile time, each expression is analyzed and classified:
Fast Path
Handles simple expressions—field lookups, comparisons, and 21 built-in functions applied to pure paths. These are evaluated directly against raw JSON bytes without ever fully parsing the document. For "account.status = 'active'" you get 0 heap allocations.
Full Path
Everything else goes through a complete parser and evaluator with full JSONata 2.x semantics. This does parse the JSON, but only the subtrees it actually needs.
Streaming Layer
- All field paths from all expressions are merged into a single scan
- After warm-up, the hot path is lock-free
- Memory is bounded with configurable cache capacity
Performance Results
- Simple lookups: 1,000x speedup (eliminating RPC overhead entirely)
- Complex expressions: 25-90x faster than RPC path
- Correctness: 1,778 test cases + 2,107 integration tests
Shadow Mode and Rollout
- Day 1: gnata built, PR opened
- Days 2-6: Code review, QA against real production expressions, deployed to preprod in shadow mode
- Day 7: Three consecutive days of zero mismatches, gnata promoted to primary
By promotion, gnata had already processed billions of events and produced identical results to jsonata-js. They also caught bugs in jsonata-js itself—cases where the reference implementation doesn't follow its own spec.
Beyond gnata - The Next $200K
Eliminating the RPC fleet took care of $300K, but there was one more thing: batching events end-to-end in their rule engine.
JSONata—being only able to do a single evaluation at a time—forced the infra around it to contort with workarounds. They were spinning up tens of thousands of goroutines, resulting in excessive memory and high CPU contention.
With gnata, they replaced the rule engine internals with a simpler, more efficient implementation. The result: another ~$18K/month—around $200K/year.
Combined: $500K/year gone from the pipeline, all in under 2 weeks of work.
No Longer Just Vibecoding
"I believe gnata is just the beginning. I suspect 2026 will be the year of surgical refactors."
The approach: port existing test suite to target language, point AI at it, implement until tests pass. This is a systematic way to use AI for significant code migrations.