Compiler?

ℹ️
in reference to what makes protobuf faster?.

You write code in a language humans can read. The computer only understands binary (0s and 1s). A compiler bridges that gap.

This is why protobuf needs a compiler you write the schema in .proto format, run protoc, and it generates Go structs for you. You never write those structs by hand.


What is Protobuf the full picture

1. You define your data shape in a .proto file
        ↓
2. protoc compiler generates Go code from it
        ↓
3. Your Go code uses those generated structs
        ↓
4. Protobuf serializes them to compact binary for transport
        ↓
5. Receiver deserializes binary back to struct

Compare JSON and Protobuf:

NOW (JSON)
Go struct -> json.Marshal -> {"key":"value"} -> wire -> json.Unmarshal -> Go struct
           [you write this]  [text, large]          [you write this]

PROTOBUF
Go struct -> proto.Marshal -> [binary] -> wire -> proto.Unmarshal -> Go struct
           [generated]      [compact]          [generated]

The marshal/unmarshal code is generated for you. You never write it.