mirror of
https://github.com/nlohmann/json.git
synced 2025-07-28 12:02:00 +03:00
Optimize output vector adapter write (#3569)
* Add benchmark for cbor serialization and cbor binary data serialization * Use std::vector::insert method instead of std::copy in output_vector_adapter::write_characters This change increases a lot the performance when writing lots of binary data.
This commit is contained in:
@ -14250,7 +14250,7 @@ class output_vector_adapter : public output_adapter_protocol<CharType>
|
||||
JSON_HEDLEY_NON_NULL(2)
|
||||
void write_characters(const CharType* s, std::size_t length) override
|
||||
{
|
||||
std::copy(s, s + length, std::back_inserter(v));
|
||||
v.insert(v.end(), s, s + length);
|
||||
}
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user