HeadlinesBriefing favicon HeadlinesBriefing.com

GitHub's creationix/rx: Binary Data Tool Cuts JSON Size and Overhead

Hacker News •
×

creationix/rx offers a drop-in replacement for JSON.stringify and JSON.parse that dramatically reduces output size and memory pressure. It produces binary-encoded data 18 times smaller than JSON by leveraging de-duplicated strings, shared schemas, and prefix-compressed paths. Crucially, it enables 23,000x faster single-key lookups through O(log n) binary search on sorted indexes directly within the encoded bytes, eliminating the need for a parse step.

This results in near-zero heap allocations, as the parsed result is a Proxy over a flat byte buffer, preventing garbage collection overhead. The tool includes a CLI for conversion and inspection, supporting pretty-printing, JSON conversion, and streaming. REXC also provides low-level cursor APIs for zero-allocation traversal, making it ideal for performance-critical applications like large-scale website deployment manifests. Its architecture supports both string-based and Uint8Array-based operations, with options for indexing and external references, offering a significant alternative to traditional JSON handling.