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:
Romain Reignier authored and GitHub committed 2022-07-08 08:12:00 +02:00
1 parent 7d361ec8ef
commit d4daaa897f
3 files changed
+63 -2

No files matched your search

@@ -53,7 +53,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: