• Damian Gryski's avatar
    Remove binary.{Read,Write} in favour of doing it by hand · 4e6b529c
    Damian Gryski authored
    The encoding/binary.{Read,Write} methods use reflection which is slow.
    This is ok for prototyping but has a serious performance impact.  In
    each case, we know exactly what we're trying to write out, so we'll
    allocate our own buffer and do the explicit conversion ourselves.
    
    As an example of the performance improvement this makes, here are the
    results from an (internal) benchmark:
    
    benchmark          old ns/op    new ns/op    delta
    BenchmarkDecode       427190       318845  -25.36%
    4e6b529c
encode.go 4.84 KB