Make proto2 benchmarks use ParsePartial, to make results vs upb more comparable.

ParsePartial does not check that required fields are set, which upb
also currently does not do.

This sped up proto2 reflection by 40%, but upb is still 7x faster in
a comparable test (instead of 11x, like before).
pull/13171/head
Joshua Haberman 14 years ago
parent 65b57a2813
commit 6f6a2937bf
  1. 2
      benchmarks/parsetostruct.proto2_compiled.cc
  2. 2
      benchmarks/parsetostruct.proto2_table.cc

@ -29,7 +29,7 @@ static void cleanup()
static size_t run(int i)
{
if(!msg[i%NUM_MESSAGES].ParseFromString(str)) {
if(!msg[i%NUM_MESSAGES].ParsePartialFromString(str)) {
fprintf(stderr, "Error parsing with proto2.\n");
return 0;
}

@ -38,7 +38,7 @@ static void cleanup()
static size_t run(int i)
{
if(!msg[i%NUM_MESSAGES]->ParseFromString(str)) {
if(!msg[i%NUM_MESSAGES]->ParsePartialFromString(str)) {
fprintf(stderr, "Error parsing with proto2.\n");
return 0;
}

Loading…
Cancel
Save