Unshaped Protos Beyond Code Generation for Protocol Buffers
summary
Library takes Scala case classes and generates Protocol Buffer serializers without .proto files, using three approaches: manual, slow runtime reflection, and generic derivation via shapeless HList + implicit induction. Macros then generate compile-time code that matches hand-generated performance (benchmark shows macros near baseline, generic derivation slower due to HList boxing, reflection about two orders of magnitude slower). Supports custom field serializers, decoding remains unresolved for out-of-order fields, and macros improve error messages but make debugging harder. Use Magnolia for recursive types.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 0:35Why scalloped EB
- 3:02What are protocol buffers
- 6:05Why use protocol buffers
- 10:50Runtime reflection
- 13:10Generic derivation
- 13:56Hlists
- 15:50Generic
- 18:13Implicit Search
- 19:48Failed Serializer
- 20:42Generic Descriptor
- 21:30Message Sterilizer
- 23:30Message Serializer
- 24:52Review
- 34:40Performance benchmark
related talks
43mAdventures in Metaprogramming: Macros versus Shapeless
42mAvoiding macros with inline and derived
49mRoll Your Own Shapeless
34mMaterialize Typeclasses with Magnolia
48mMetaprogramming in Dotty
12mMulti-Stage Programming with Generative and Analytical Macros
01h 12mDeriving pleasure
44mMetaprogramming 2.0
