Imho, io.Pipe() creates buffer under the hood as well. But yea, it's faster, as you don't need to wait for the whole encoded data via json.Marshal() but you can stream the encoded bytes right away.
It actually doesn't. From the docs: "[..] Reads on one end are matched with writes on the other, copying data directly between the two; there is no internal buffering.[..]"
Interesting :) good to know!
Contribute to go-datastructures development by creating an account on GitHub.