Files
json/single_include/nlohmann
Niels Lohmann bc94203dbc Throw, and write high-precision numbers, from functions of their own
Functions that check something that almost never fails kept the code that
builds the exception in their own body: check_utf8() of BON8 (a std::string
for the message), the NUL check of a BSON key, the length checks of
MessagePack and BSON, the subtype checks, the size marker check of UBJSON, the
integer range check of BON8, and the high-precision number of UBJSON (a
basic_json and a string, for every integer that picks the marker `H`). That
gave them a frame with a stack protector under GCC, and made the compiler
spill registers for a path that is not taken.

Each of these is now thrown, or written, by a function that is not inlined.
The messages and exception ids are the same.

Instructions per call (Linux, GCC 13, thousands), to_bson: 20000 small objects 31714 -> 29614, twitter 4930 -> 4637; to_ubjson: citm_catalog 7020 -> 6597; to_bjdata: citm_catalog 7192 -> 6789; to_bon8: citm_catalog 7107 -> 6790.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2026-10-22 09:29:29 +02:00
..