I previously worked at Bytedance and we've maintained a Rust zero-copy gRPC/Thrift implementation for 4 years: https://github.com/cloudwego/volo , it is based on Bytes crate (reference counting bytes, for folks don't familiar with Rust ecosystem). A fun fact: when we measuring on our product environment, zero-copy isn't means higher performance in lots of scenarios, there are some trade-offs: 1. zero-copy means bytes…
Zero-copy protobuf and ConnectRPC for Rust
31–40 of 47 posts
Re: Zero-copy protobuf and ConnectRPC for Rust
#32(For full disclosure, I started the ConnectRPC project - so of course I’m excited about that part of the announcement too.)
Re: Zero-copy protobuf and ConnectRPC for Rust
#33Earlier quoted context omitted.
Is this still true? New versions of protobuf allow codegen of `std::string_view` rather than `const std::string&` (which forces a copy) of `string` and `repeated byte` fields. https://protobuf.dev/reference/cpp/string-view/
It allows avoiding allocations, but it doesn't allow using serialised data as a backing memory for an in-language type. Protobuf varints have to be decoded and written out somewhere. They cannot be lazily decoded efficiently either: order of fields in the serialised message is unspecified, hence it either need to iterate message over and over finding one on demand or build a map of offsets, which negates any wins zer…
In some message schemas even though this isn't truly zero copy it may be close to it in terms of actual overhead and CPU time, in other schemas it doesn't help at all.
Re: Zero-copy protobuf and ConnectRPC for Rust
#34Re: Zero-copy protobuf and ConnectRPC for Rust
#35Re: Zero-copy protobuf and ConnectRPC for Rust
#36I'd like to use this, but I don't want to refactor all my services when they change the request/response types. Interested to know the timing of 1.x. It seems to be moving pretty fast atm - hopefully that momentum keeps going.
Re: Zero-copy protobuf and ConnectRPC for Rust
#37It's 2026 and I'm still defining my own messaging and wire protocols. Plain C structs that fit in a UDP datagram that you can reinterpret_cast from is still best. You can still provide schemas and UUIDs for that, and dynamically transcode to JSON or whatever.
TL;DR protobuf has version compatibility and compact number encoding.
Re: Zero-copy protobuf and ConnectRPC for Rust
#38It's 2026 and I'm still defining my own messaging and wire protocols. Plain C structs that fit in a UDP datagram that you can reinterpret_cast from is still best. You can still provide schemas and UUIDs for that, and dynamically transcode to JSON or whatever.
Until you have to work with big and little endian systems. There are other weirdness about how different computers represent things as well. utf-8 / ucs-16 strings (or other code pages). Not all floats are ieee-754. Still when you can ignore all those issues what you did is really easy and often works.
Re: Zero-copy protobuf and ConnectRPC for Rust
#39It's 2026 and I'm still defining my own messaging and wire protocols. Plain C structs that fit in a UDP datagram that you can reinterpret_cast from is still best. You can still provide schemas and UUIDs for that, and dynamically transcode to JSON or whatever.
Provided that: - you agree never to care about endianness (can probably get away with this now) - you don't want to represent anything complicated or variable length, including strings