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 2022-07-04 17:25:16 +02:00
parent ef5af0c8f8
commit bb1abe96a4
2 changed files with 2 additions and 2 deletions

View File

@ -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:

View File

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