- Reco principal data engineer Nir Barak used AI to rewrite JSONata from JavaScript to Go in seven hours, spending $400 in AI token costs.
- The resulting Go library, gnata, achieved a 1,000x speedup on common expressions and eliminated $300,000/year in RPC fleet costs.
- Combined with downstream pipeline optimizations the rewrite enabled, total annual savings reached $500,000.
- The approach relied entirely on JSONata’s existing 1,778-test suite as a behavioral specification, with a seven-day shadow deployment to verify production equivalence.
What Happened
Nir Barak, a principal data engineer and architect at SaaS security company Reco, published a detailed case study describing how he used AI-assisted code generation to port JSONata, a widely used JSON query and transformation language originally written in JavaScript, into a pure Go implementation in a single working session.
The project produced gnata, a 13,000-line pure Go library implementing the full JSONata 2.x specification. Barak completed the initial working version in seven hours at a cost of approximately $400 in AI tokens. “Seven hours, $400 in tokens, a 1,000x speedup on common expressions, and the start of a chain of optimizations that ended up saving us $500K/year,” Barak wrote in the post. The case study quickly gained traction on Hacker News and engineering blogs.
Why It Matters
Reco’s policy engine evaluates JSONata expressions against billions of security events flowing through its data pipeline. The original architecture required Remote Procedure Calls between Go services and Node.js JSONata evaluators, adding approximately 150 microseconds of serialization overhead per evaluation. At Reco’s scale, that overhead translated to roughly $300,000 per year in compute costs for the RPC fleet alone.
Eliminating the JavaScript dependency removed the entire RPC layer. The native Go implementation runs in-process, cutting network serialization costs to zero. With JSONata evaluation now happening natively within the Go pipeline, Reco’s team was able to restructure the surrounding data processing stages, unlocking further pipeline optimizations that added another $200,000 in annual savings.
Technical Details
The rewrite used what has been described as “vibe porting,” a technique where an existing test suite serves as the complete behavioral specification for the target implementation. JSONata’s official test suite contains 1,778 test cases covering the full language specification. Barak fed these tests to an AI code generation model and iteratively built the Go implementation until all tests passed.
The approach mirrors a method Cloudflare used to port Next.js to its Workers platform. Rather than manually translating code line by line, the AI generates functionally equivalent code in the target language, with the test suite serving as the automated correctness checker.
After the initial implementation, Reco ran a seven-day shadow deployment. Both the original JavaScript and new Go implementations processed the same production traffic simultaneously, with outputs compared for equivalence. Only after confirming identical behavior across all production workloads did the team cut over to the Go version.
Who’s Affected
Engineering teams maintaining cross-language dependencies in performance-critical pipelines have the most direct parallel. Any system that shells out to a different runtime for a specific function, such as calling Python from Java or JavaScript from Go, pays a similar RPC and serialization tax that a native rewrite could eliminate.
The approach is most applicable when a comprehensive test suite already exists. Without one, the AI-generated code has no automated way to verify correctness, and the time saved on writing code would be consumed by writing tests and debugging edge cases. Projects with poor test coverage or undocumented behavioral quirks would require significantly more human oversight to port reliably.
What’s Next
The case study generated significant discussion on Hacker News, where critics noted that the $500,000 savings figure combines the direct rewrite benefit with broader pipeline optimizations, making it difficult to isolate the AI-generated code’s specific contribution. Others pointed out that the seven-hour timeline covers only the initial code generation and does not account for subsequent debugging, production hardening, or the week of shadow deployment validation.
Teams considering a similar approach should budget for shadow deployment infrastructure and expect the total effort to extend well beyond the initial code generation session. The gnata library is not publicly available, so other organizations cannot reuse it directly and would need to run their own AI-assisted porting effort against the JSONata test suite.
Related Reading
- Software Engineer Warns AI Code Generation Creates $10T Maintenance Crisis
- Engineer Joel Andrews Makes Case Against AI Coding Agents in Production
- India AI Summit Draws 300,000 Attendees, Yields $250 Billion in Investment Pledges
- Research Paper Maps the Full Stack for Designing Custom AI Chips
- Software Engineer Argues Executive-IC Divide on AI Stems from Risk Tolerance