mirror of
https://github.com/nlohmann/json.git
synced 2026-10-22 14:08:13 +00:00
Every line of a pretty-printed document starts with its indentation, which was written by calling memset with a length known only at run time. An indentation of up to 32 characters, with room in the write buffer, stores four words of the indentation character and claims the part it needs. Wider indentations and a nearly full buffer take the unchanged path. Apple M1, Apple clang, retired instructions per dump(4), on top of the previous changes: canada 50.7M -> 44.4M (-13 %) citm_catalog 8.85M -> 7.48M (-16 %) twitter 5.13M -> 4.71M (-8 %) jeopardy 564M -> 518M (-8 %) a 139-byte object 3277 -> 2924 (-11 %) Linux x86-64 (callgrind), the whole series against develop, gcc 13 / clang 18: canada, indent 4: -13 % / -14 %. Signed-off-by: Niels Lohmann <mail@nlohmann.me>