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:
parent
ef5af0c8f8
commit
bb1abe96a4
@ -53,7 +53,7 @@ class output_vector_adapter : public output_adapter_protocol<CharType>
|
|||||||
JSON_HEDLEY_NON_NULL(2)
|
JSON_HEDLEY_NON_NULL(2)
|
||||||
void write_characters(const CharType* s, std::size_t length) override
|
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:
|
private:
|
||||||
|
|||||||
@ -14247,7 +14247,7 @@ class output_vector_adapter : public output_adapter_protocol<CharType>
|
|||||||
JSON_HEDLEY_NON_NULL(2)
|
JSON_HEDLEY_NON_NULL(2)
|
||||||
void write_characters(const CharType* s, std::size_t length) override
|
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:
|
private:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user