The Buf blog

RSS feed
Protobuf

Protobuf Tip #9: Some numbers are more equal than others

The first 15 field numbers are special: most runtimes will decode them much faster than the other field numbers. When designing a message type for decoding performance, it’s good to use these field numbers on fields that are almost always present.

Protobuf

Protobuf Tip #8: Never use required

Don’t use 'required' to modify fields—you won’t be able to get rid of it later when you realize it was a bad idea.

Protobuf

Protobuf Tip #7: Scoping it out

buf convert and protoscope are powerful tools for examining and debugging wire format dumps.

Protobuf

Protobuf Tip #6: The subtle dangers of enum aliases

Enum values are a poorly designed feature and shouldn’t be used.

Protobuf

Protobuf Tip #4: Accepting mistakes we can’t fix

Protobuf’s distributed nature introduces evolution risks that make it hard to fix some types of mistakes. Sometimes the best thing to do is to just let it be.

Protobuf

Protobuf Tip #3: Enum names need prefixes

Enums inherit some unfortunate behaviors from C++. Avoid this problem by using the Buf lint rules ENUM_VALUE_PREFIX and ENUM_ZERO_VALUE_SUFFIX.

Protobuf

Protobuf Tip #2: Compress your Protos!

Compression is everywhere. This pervasiveness means that wire size tradeoffs matter less than they used to twenty years ago, when Protobuf was designed.

Protobuf

Protobuf Tip #1: Field names are forever

Don’t rename fields. Even though there are a slim number of cases you can get away with it, it’s rarely worth doing, and is a potential source of bugs.

November 20, 2024Timo Stamm and Joe Rinehart
Connect

Connect RPC for JavaScript: Connect-ES 2.0 is now generally available

Today, we’re announcing the 2.0 release of the Connect-ES project, the TypeScript implementation of Connect for Web browsers and Node.js. This release introduces improved support for major frameworks and simplified code generation. Connect-ES 2.0 now uses Protobuf-ES 2.0 APIs to leverage reflection, extension registries, and Protobuf custom options. The 2.0 release is a major version bump and comes with breaking changes. Read on to learn what’s changed and how to migrate to the 2.0 release.

Get started on the path to universal schema adoption

Across your entire data stack — from your network APIs to your streaming data to your data lake.