mirror of
https://github.com/nlohmann/json.git
synced 2026-10-22 14:08:13 +00:00
The head of an array or object of up to 23 elements (15 for MessagePack) is a single byte, but it was written through write_cbor_head()/write_number(), which GCC keeps out of line, and a std::array. The CBOR array and object writers now write that byte directly, and MessagePack does the same in its array and map prefixes. Instructions per call (Linux, GCC 13, thousands), to_cbor: citm_catalog 5588 -> 5020, canada 15840 -> 14499, 20000 small objects 13162 -> 12582; to_msgpack: citm_catalog 5920 -> 5676, canada 16344 -> 15676. Signed-off-by: Niels Lohmann <mail@nlohmann.me>