Got our performance back by tweaking AssignToString.

plain.parsetoproto2_googlemessage1.upb_jit: 254 -> 324 (27.56)
omitfp.parsetoproto2_googlemessage1.upb_jit: 220 -> 332 (50.91)
pull/13171/head
Josh Haberman 13 years ago
parent bf0308ebc5
commit 26ed1e9961
  1. 9
      bindings/cpp/upb/bytestream.hpp

@ -207,11 +207,12 @@ class ByteRegion : public upb_byteregion {
template <typename T> void AssignToString(T* str) {
uint64_t ofs = start_ofs();
str->clear();
str->reserve(Length());
size_t len;
const char *ptr = GetPtr(ofs, &len);
str->assign(ptr, len);
ofs += len;
while (ofs < end_ofs()) {
size_t len;
const char *ptr = GetPtr(ofs, &len);
ptr = GetPtr(ofs, &len);
str->append(ptr, len);
ofs += len;
}

Loading…
Cancel
Save