mirror of
https://github.com/nlohmann/json.git
synced 2026-10-22 22:08:55 +00:00
A pretty-printed array or object wrote ",\n", checked the room for the indentation, and stored it, for every element. The line break and the usual indentation (up to 32 characters, with room in the write buffer) are now written with one check and one run of stores, also after the opening bracket and in front of the closing one. Other indentations take the unchanged path. Apple M1, Apple clang, retired instructions per dump(4), on top of the previous changes: citm_catalog 7.28M -> 7.06M (-3 %) canada 44.4M -> 43.3M (-3 %) twitter 3.91M -> 3.78M (-3 %) jeopardy -1 % Linux x86-64 (callgrind), gcc 13 / clang 18, dump(4) / dump(1, '\t'): citm_catalog dump(4) -3 % / -4 %, tab -4 % / -5 %, with the function inlined (without that GCC wrote the combined step out of line and was 5 % slower than before the change). Compact output is unchanged. Signed-off-by: Niels Lohmann <mail@nlohmann.me>