On Sep 20, 2020, at 9:19 PM, Vinnie Falco
wrote: The algorithm first tries to fit the output into a local 4kb stack buffer. For serialized JSONS smaller than this size it should result in a std::string that allocates only what is needed. I am guessing that your serialized JSONs are larger (or else the resulting string would be perfectly sized).
Yeah it was several hundred MB in the test I was trying.
The library implementation tries to provide good general purpose performance but there will always be use-cases that it handles sub-optimally. If you have additional information about your typical JSONs, you might see a benefit to writing your own string conversion algorithm by making a copy of the `serialize_impl` function and adjusting its heuristics to better match your data. This is precisely why `json::serializer` is exposed as a public interface.
Nice. Thanks! -hadriel