summaryrefslogtreecommitdiff
path: root/bindings/cpp/upb/bytestream.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/cpp/upb/bytestream.hpp')
-rw-r--r--bindings/cpp/upb/bytestream.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/bindings/cpp/upb/bytestream.hpp b/bindings/cpp/upb/bytestream.hpp
index 8b48690..37d8157 100644
--- a/bindings/cpp/upb/bytestream.hpp
+++ b/bindings/cpp/upb/bytestream.hpp
@@ -209,6 +209,10 @@ class ByteRegion : public upb_byteregion {
uint64_t ofs = start_ofs();
size_t len;
const char *ptr = GetPtr(ofs, &len);
+ // Emperically calling reserve() here is counterproductive and slows down
+ // benchmarks. If the parsing is happening in a tight loop that is reusing
+ // the string object, there is probably enough data reserved already and
+ // the reserve() call is extra overhead.
str->assign(ptr, len);
ofs += len;
while (ofs < end_ofs()) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback