Files
releases/server/writer
Anders Eknert d001ac49d2 perf: use json.Encode to avoid extra allocation (#5596)
When sending JSON back to the client — and we do a lot of that, use
the streaming implementation of json.Encode rather than marshalling
the data into an intermediate byte array.

One curious detail here is that the streaming implementation
uses newlines to mark the end of the stream, so a few unit tests had
to be updated to expect this. Previously we would only emit a trailing
newline if "pretty" was configured.

Signed-off-by: Anders Eknert <anders@styra.com>
2023-01-26 09:49:19 +01:00
..