mirror of
https://github.com/nlohmann/json.git
synced 2026-11-01 18:35:34 +00:00
The lexer chose between the copying and the checking string scan at run time in scan(). Both scans were then inlined into the scan() of parse() as well, which made json::parse() of jeopardy.json indented by 4 2 % slower on Apple M1 (same instruction count). Whether token values are discarded is now a template parameter (DiscardValues) of lexer and parser, false by default; only accept() instantiates the parser with true. parse() gets a lexer with the copying scan only, and without the run-time checks of the number paths. Apple M1, A/B against develop, 6 code layouts: parse() of indented jeopardy 1.020 -> 1.003, twitter 1.006 -> 1.005; accept() twitter 1.012 -> 1.002, tree-pretty 1.016 -> 1.004, mesh 1.000 -> 0.940, twitter_min 0.990 -> 1.009, citm_catalog 0.937 -> 0.950, gsoc-2018 0.838 -> 0.836. Signed-off-by: Niels Lohmann <mail@nlohmann.me>