Define object_buffer_limit from key_index_threshold
Both mark the size up to which a linear key search is cheap: an object stays on the stack until then and, once spilled, looks up its keys in the hash index right away. Defining one from the other keeps them from drifting apart. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+10
-6
No files matched your search
@@ -1322,9 +1322,11 @@ class json_sax_dom_parser : public json_sax_dom_error_state
|
||||
}
|
||||
|
||||
/// the number of members an object collects on the stack before it
|
||||
/// switches to storing them directly; this is the size from which the
|
||||
/// stored object looks up its keys in a hash table (key_index_threshold)
|
||||
static constexpr std::size_t object_buffer_limit = 64;
|
||||
/// switches to storing them directly; both collect_member() and a stored
|
||||
/// object below key_index_threshold search their keys linearly, so the
|
||||
/// object stays on the stack as long as a linear search is cheap, and a
|
||||
/// spilled object looks up its keys in a hash table right away
|
||||
static constexpr std::size_t object_buffer_limit = key_index_threshold;
|
||||
|
||||
void reserve_members()
|
||||
{
|
||||
|
||||
Generated
+5
-3
@@ -17540,9 +17540,11 @@ class json_sax_dom_parser : public json_sax_dom_error_state
|
||||
}
|
||||
|
||||
/// the number of members an object collects on the stack before it
|
||||
/// switches to storing them directly; this is the size from which the
|
||||
/// stored object looks up its keys in a hash table (key_index_threshold)
|
||||
static constexpr std::size_t object_buffer_limit = 64;
|
||||
/// switches to storing them directly; both collect_member() and a stored
|
||||
/// object below key_index_threshold search their keys linearly, so the
|
||||
/// object stays on the stack as long as a linear search is cheap, and a
|
||||
/// spilled object looks up its keys in a hash table right away
|
||||
static constexpr std::size_t object_buffer_limit = key_index_threshold;
|
||||
|
||||
void reserve_members()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user