It would be nice if Json::Value had a member function void reserve(size_t sz); to reserve space (without filling it), in the same way as the standard C++ template std::vector. So if a Json::Value jv is an object jv.reserve(5) would pre-allocate (without resizing it!) memory for at least 5 attribute-value entries, and if jv is an array jv.reserve(12) would pre-allocate memory for 12 array components.
This could change the complexity of programs filling progressively a Json::Value (e.g. a loop doing an append)
Ii am not familiar enough with the implementation to quickly propose a patch.
Basile Starynkevitch - http://starynkevitch.net/Basile/
I want to provide builders for Value. We could then support such a requirement easily.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.