On Thu, Feb 29, 2024 at 9:26 PM Peter Dimov
Zach Laine wrote:
Thanks. I fixed it as well, and now I get about 1.5-2X worse performance than Boost.JSON. I'm just building the "pretty" example from Boost.JSON, and "json" and "callback_json" from my examples. When I feed these the file at https://world.openfoodfacts.org/api/v0/product/5060292302201.json , and prepend "time", I get these results:
pretty (Boost.JSON): real 0m0.014s user 0m0.004s sys 0m0.000s
json (Parser): real 0m0.022s user 0m0.020s sys 0m0.000s
callback_json (Parser, no JSON object creation): real 0m0.023s user 0m0.018s sys 0m0.004s
I'm not sure what the tests reported earlier were doing, but I definitely don't see orders of magnitude difference.
I used this file:
https://github.com/boostorg/json/blob/develop/bench/data/twitter.json
Using that file, I get similar results to what I already posted (the numbers are different, but the ratios between them are the same). I managed to make a change that was much smaller -- no template parameter required. I consistenty see 1.5x slowdown for Parser vs. Boost.JSON for files around this size, and 2x or so for much larger files (~25MB). I went ahead and committed the template-parameter approach on a branch, https://github.com/tzlaine/parser/tree/tmpl_param_for_scoped_trace . It made no difference vs. the mid-review branch I've been working on, or at least not for GCC+Linux. Zach