Replacing Protobuf with Rust to go 5 times faster
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
PgDog replaced Protobuf serialization with direct C-to-Rust bindings in their PostgreSQL proxy, achieving 5x faster query parsing and 10x faster deparsing. The team forked pg_query.rs and used bindgen with AI-assisted code generation to create 6,000 lines of recursive conversion code that maps C structs directly to Rust. Profiling revealed Protobuf deserialization as the bottleneck, not the Postgres parser itself. The new implementation uses unsafe Rust with recursive algorithms for better CPU cache locality and zero additional memory allocation, resulting in 25% overall performance improvement in pgbench benchmarks.
1 Comment
Sort: