A high-performance Rust JSON library leveraging SIMD for parsing and serialization.
sonic-rs is a Rust JSON library built for extreme performance, leveraging SIMD instructions to accelerate parsing, serialization, and field extraction. It serves as a high-speed alternative to serde_json, offering both typed (via serde) and untyped JSON manipulation with minimal overhead.
Rust developers working on performance-critical applications like web servers, data pipelines, or real-time systems where JSON processing is a bottleneck.
Developers choose sonic-rs for its significant speed improvements over serde_json and simd-json, achieved through direct SIMD optimizations, memory arena allocation, and zero-copy lazy field access, all while maintaining serde compatibility.
A fast Rust JSON library based on SIMD.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show 2-4x speed improvements over serde_json in deserialization and serialization, achieved through SIMD optimizations for parsing long strings and skipping whitespace.
Acts as a drop-in replacement for serde_json by re-exporting serde traits, allowing easy migration without changing struct definitions or serde usage.
Uses a memory arena for untyped values, reducing allocations and improving cache-friendliness, which contributes to faster document parsing as explained in benchmark details.
Provides lazy field extraction with pointer paths, leveraging SIMD to skip unnecessary data for rapid retrieval, as demonstrated in the get_from benchmarks with microsecond-level performance.
Performance is optimal only on x86_64 and aarch64; other architectures use slower fallbacks, limiting portability and effectiveness in heterogeneous environments.
Requires adding `-C target-cpu=native` compile flags and host compilation for SIMD, complicating cross-compilation, CI/CD pipelines, and deployment on unknown hardware.
Enabling the sanitize feature for LLVM-sanitizers causes a 30% performance loss in serialization, forcing a trade-off between development tooling and production speed.