diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2012-03-31 12:17:32 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2012-03-31 12:17:32 -0700 |
commit | cca4818eb7769d6e776bdc30516a5f871f1d6393 (patch) | |
tree | e67dd65d5c016028ae976b09b2d69f6b7525aa5f /bindings/cpp/upb/bytestream.hpp | |
parent | 26ed1e996171c8ffa2ced42ac69b1b82c1956e1f (diff) |
Sync from internal Google development.
Diffstat (limited to 'bindings/cpp/upb/bytestream.hpp')
-rw-r--r-- | bindings/cpp/upb/bytestream.hpp | 4 |
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()) { |