Unshaped Protos: Beyond Code Generation for Protocol Buffers
summary
Starts from Scala case classes and generates Protocol Buffers serializers and schemas instead of requiring .proto files; explores four implementations: manual (tedious), runtime reflection (works but very slow and fails at runtime), generic derivation with Shapeless HLists (compile-time, safer but slower due to boxing and rep conversions), and implicit macros that emit code at compile time. Built a macro-based ScalaPB extension that mostly matches hand-generated performance; measured with JMH benchmarks showing macros close to generated code and far faster than reflection.
AI-written summary · about
chapters (8)
- 0:00Start
- 5:00The Basics: Serializing
- 6:34Protoless Protos
- 10:21Manual Definition
- 11:21Runtime Reflection
- 18:33Option 3: Inductive Implicit Search
- 24:54Option 3: Generic Derivation
- 33:37Option 4: Implicit Macros
related talks
23mEffective Protobuf: Everything You Wanted To Know, But Never Dared To Ask
48mProtocol Buffers- A Banked Journey
29mTHE LAST FRONTIER AND BEYOND
37mProtobuf and buf: glamour, misery, and import substitution
21mManaging Protocol Buffers at Scale
35mShow Me the Schema! RPCs and Learning to Love Code Gen
24mGenerating ergonomic C++ APIs using Rustdoc, procedural macros, and Serde
13mFrom Writing REST to Writing gRPC
