logo

Proto Edition 2024 vs Proto Edition 2023

In the Protocol Buffers (Protobuf) ecosystem, Editions are the new way to manage versions, replacing the old proto2 and proto3 syntax. Instead of hardcoded behaviors, Editions use "features" that can be toggled on or off.

As of 2026, Edition 2024 is the current standard, having succeeded Edition 2023. Here is the breakdown of the differences between them.

1. Release Timeline & Purpose

  • Edition 2023: Released in mid-2024 (with protoc v27.0). Its primary goal was to provide a "baseline" that unified proto2 and proto3 into a single format. It didn't introduce many new behaviors but translated existing ones into the "Features" system.
  • Edition 2024: Released in late 2025 (with protoc v32.0). It is the first edition to introduce major new language features and change default behaviors that had been static for years.

2. Major Technical Differences

Feature Edition 2023 Edition 2024
Symbol Visibility All symbols (messages, enums) are public/exported by default. Introduces local and export keywords.
Default Visibility Global visibility. EXPORT_TOP_LEVEL (Top-level symbols are public; nested ones are private by default).
C++ String Type Defaults to STRING (standard std::string). Defaults to VIEW (uses std::string_view for better performance).
Import System Uses import weak (inherited from proto2). Replaces import weak with import option.
Field Options Supports legacy ctype. ctype is removed; you must use the string_type feature.
Naming Styles Flexible (legacy) naming styles. Introduces enforce_naming_style for strict round-trippable naming.

3. Key Improvements in Edition 2024

Symbol Visibility (local vs export)

In Edition 2023, every message you defined could be imported by any other file. This often led to "bloated" binaries because the compiler couldn't tell which messages were internal. Edition 2024 introduces:

  • local: Marks a message/enum as private to its file.
  • export: Explicitly marks it as part of the public API.

Performance: string_view by default

For C++ users, Edition 2024 changes the default behavior for string accessors. By defaulting to string_view, it avoids unnecessary allocations and copies when reading data, providing a significant performance boost "for free" when you upgrade your edition.

The import option Syntax

Edition 2024 cleans up how custom options are handled. In 2023 and earlier, you often had to use "weak imports" to avoid circular dependencies when using custom options. Edition 2024 uses import option, which tells the compiler: "I only need the definitions of these options, don't generate code for the messages inside this file."

4. Migration: 2023 to 2024

Because Editions use a feature-flag system, migrating is safer than the old proto2 to proto3 move:

  1. Prototiller Tool: Google provides a tool called prototiller that automatically updates your .proto files.
  2. Compatibility: When you change edition = "2023" to edition = "2024", the tool will automatically add explicit feature overrides to preserve your old behavior (e.g., it might add [features.pb.cpp.string_type = STRING] so your C++ code doesn't break) until you are ready to adopt the new defaults.

Summary

Edition 2023 is a "safe" bridge for moving away from proto3. Edition 2024 is where the performance and organizational benefits (like private symbols and faster C++ strings) actually begin.