reduce allocations in (*JSONArrayBuf).Append()
Created by: camdencheek
In the profiles I was looking at for searcher, large searches had a few hundred megabytes of live byte slices coming from json.Marshal() that hadn't been garbage collected. We can avoid allocating a (large) byte slice for each match by using an encoder.
I started investigating this because we were seeing OOMKilled for very large streaming searches, and it appears to be because we are allocating faster than things are being garbage collected. This should help alleviate that, as well as generally improve performance.