Description
I have a proposed solution to the performance issues with Value.MarshalJSON().
I believe that most of the cost is due to malloc() and garbage collection. So in addition to Value.MarshalJSON(), I am proposing a new method Value.WriteJSON() to be used in writeResults(), instead of Value.MarshalJSON().
Value.WriteJSON() would allocate zero or minimal memory.
Here is the signature:
Value.WriteJSON(w io.Writer, prefix, indent string) error
If pretty = false, we would set prefix and indent to “”.
If this sounds interesting, you can take a look and do some experiments and measurements for Watson, or a quick follow on release.
Thanks,
Gerald