mirror of
https://github.com/nlohmann/json.git
synced 2026-10-22 14:08:13 +00:00
Without use_type, a binary value is an array of its bytes, and was written one sink call per marker and per byte (UBJSON, BJData), or through the integer ladder for each byte (BON8). The bytes are now encoded in blocks into space reserved from the sink, by a function that is not inlined. BON8 stores both bytes of an integer above 39 and keeps the second only if it is needed, so that the code does not branch on the value. Instructions per call for a 1 MB binary value (Linux, GCC 13, thousands): to_ubjson 34253 -> 9521, to_bjdata 34253 -> 9521, to_bon8 53088 -> 17333. Signed-off-by: Niels Lohmann <mail@nlohmann.me>