mirror of
https://github.com/nlohmann/json.git
synced 2026-10-23 22:38:55 +00:00
Grow the decode arena through a function and store its position back on every return
slow_string() kept its write position in locals and grew the arena through the macro NLOHMANN_VIEW_ENSURE. The macro is now the always-inline member arena_ensure() (a lambda is not inlined at every call site by clang, which then keeps the position in memory: +11 % instructions on escape-heavy strings), and a guard stores the position back into m_arena_write on every return instead of by hand on the successful one. Instruction counts are unchanged (clang) or 1 % lower (GCC). Also word the complexity of back() as that of at(). Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
3 files changed
+109
-35
No files matched your search
@@ -28,7 +28,7 @@ This exception does not carry a [`JSON_DIAGNOSTICS`](../macros/json_diagnostics.
|
||||
|
||||
Linear in the size of the array or object: unlike [`front()`](front.md), which only ever looks at the first
|
||||
element, `back()` has to walk every element to find where they end, since elements are not a fixed size in the
|
||||
index. Constant for an array none of whose elements is an array or object, since the elements are then adjacent
|
||||
index. Constant if no element of the array is an array or object, since the elements are then adjacent
|
||||
in the index.
|
||||
|
||||
## Notes
|
||||
|
||||
Reference in new issue
Block a user