mirror of
https://github.com/nlohmann/json.git
synced 2026-10-22 14:08:13 +00:00
Replacing the path of the previous child by "/<index>" took a resize, a push_back and an append. For array elements the path is now resized once to its final length and the slash and the digits are written into it. Object keys keep the three calls: a version that also wrote them directly made flatten() of twitter 4 % slower in cycles at equal instructions. flatten() (instructions on macOS, Linux Ir GCC 13 / Clang 18): canada 172.1M -> 164.7M, 123.8M -> 120.6M / 121.2M -> 118.9M; citm_catalog 40.4M -> 39.5M, 30.1M -> 29.6M / 30.0M -> 29.6M; twitter unchanged. Signed-off-by: Niels Lohmann <mail@nlohmann.me>