Back to

Command codecgen

Latest Go to latest
Published: Jul 2, 2019 | License: MIT | Module:


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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier