Document.Encode and Array.Encode should accept a byte slice, not return it. Since the caller always knows the needed slice length (by calling size), this could allow for optimizing allocations by using memory pools, etc.
Run benchmarks before and after, and show benchstat output.
Document.Encode
andArray.Encode
should accept a byte slice, not return it. Since the caller always knows the needed slice length (by callingsize
), this could allow for optimizing allocations by using memory pools, etc.Run benchmarks before and after, and show
benchstat
output.