There are many community benchmarks that include protobuf and/or grpc, but 
whether they are representative of your use case is a different question. 
Most comparisons I've seen are either basic, use suboptimal message 
definitions, or have been specifically designed to make Protobuf look bad 
(e.g. benchmarks from competitors that are trying to establish themselves). 
IMO it's best to create your own benchmarks if you need reliable results 
for your specific use case.

Here are a few guidelines for message definitions that should generally 
help performance:

   - prefer field ids below 16 (5 bit)
   - avoid deep message nesting
   - use varint types (uint32, sint32) for small numbers (ideally max 7 
   bit, i.e., 0-128)
   - use fixed-width types (fixed32, sfixed32, etc.) for large numbers
   - use with caution: groups can be serialized more efficiently than 
   messages, but they have been deprecated and the syntax is terrible

The performance impact also depends a lot on the actual implementation, 
e.g., deep nesting hits harder on implementations that don't cache the 
computed size.


On Tuesday, June 6, 2023 at 4:00:44 AM UTC+2 Steven L Wang wrote:

> Hi:
>   Is there any benchmark for protoc buffers, which is supported or used by 
> the community? I can find many benchmarks for protoc buffers on the 
> internet. But I don't know which one is advocated by the community.
>
> Thanks,
>   -Steven
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/ddd54b17-f078-4d18-8b5a-c0ddb0f504dcn%40googlegroups.com.

Reply via email to