mirror of
https://github.com/nlohmann/json.git
synced 2026-10-22 22:08:55 +00:00
BSON stores an array as a document whose keys are the decimal indices. Both passes built that key with std::to_string() and copied it into a string_t for every element, and the size pass then validated it like an object key (a search for U+0000 and the UTF-8 handler), though a decimal number cannot fail either. The index name now lives in the array's frame as digits that are incremented in place, and the size pass adds 2 + the number of digits. Instructions per call (Linux, GCC 13, thousands), to_bson: 20000 integers 16228 -> 6486, 20000 floats 16304 -> 6562, canada 109155 -> 55282, 20000 small objects 45513 -> 37171, citm_catalog 17269 -> 15026. Signed-off-by: Niels Lohmann <mail@nlohmann.me>