Files
json/include
Niels Lohmann 4ee05e4d1f Encode runs of floats in CBOR and MessagePack arrays without a call each
Integers in an array were already encoded in runs; a float went through
write_cbor()/write_msgpack(), the NaN/infinity checks, write_compact_float()
and, for the marker and the 4 or 8 bytes of the number, two sink writes, one
of them through a std::array that was reversed and copied.

A run of floats is now encoded straight into space reserved from the sink,
like a run of integers, by a function of its own so that the loop of integers
is unchanged. The float32 check is shared with write_compact_float(). Arrays
that are empty are returned from before the elements loop, which also saves
its prologue for the many empty arrays of documents like citm_catalog.json.

Instructions per call (Linux, GCC 13, thousands), to_cbor: 20000 floats 2753 -> 1202, canada 21529 -> 16232; to_msgpack: 20000 floats 2633 -> 1202, canada 21595 -> 16791.

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