codecgen generates static implementations of the encoder and decoder functions for a given type, bypassing reflection, and giving some performance benefits in terms of wall and cpu time, and memory usage.
Benchmarks (as of Dec 2018) show that codecgen gives about
- for binary formats (cbor, etc): 25% on encoding and 30% on decoding to/from byte - for text formats (json, etc): 15% on encoding and 25% on decoding to/from byte
Note that (as of Dec 2018) codecgen completely ignores
- MissingFielder interface
(if you types implements it, codecgen ignores that)
- decode option PreferArrayOverSlice
(we cannot dynamically create non-static arrays without reflection)
In explicit package terms: codecgen generates codec.Selfer implementations for a set of types.