mirror of
https://github.com/nlohmann/json.git
synced 2026-10-16 03:07:12 +00:00
* Speed up JSON pointer parsing, formatting, comparison and lookup Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Restore unflatten() speed after the linear-time rewrite The prefix tree introduced for linear unflatten() kept a std::map per prefix, copied each token into it and looked every token up a second time while creating the values. Replace the per-prefix maps by one open-addressing table keyed by (parent, token) that refers to the parsed tokens, skip the lookups for the prefix shared with the previous key (flattened objects are mostly sorted), and derive the prefix numbers of the second pass from parent links instead of lookups. Time and memory stay linear in the pointer depth, and the result is still independent of the iteration order of the flattened object. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Put [[noreturn]] before __attribute__ on the JSON pointer throw helpers Clang 18 on Linux rejects a C++11 attribute list after a GNU __attribute__ ("an attribute list cannot appear here"). Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me>