summaryrefslogtreecommitdiff
path: root/benchmarks/parsetostruct.proto2_table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/parsetostruct.proto2_table.cc')
-rw-r--r--benchmarks/parsetostruct.proto2_table.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/benchmarks/parsetostruct.proto2_table.cc b/benchmarks/parsetostruct.proto2_table.cc
index 815834e..ded267d 100644
--- a/benchmarks/parsetostruct.proto2_table.cc
+++ b/benchmarks/parsetostruct.proto2_table.cc
@@ -8,7 +8,7 @@
static std::string str;
static google::protobuf::DynamicMessageFactory factory;
-static google::protobuf::Message *msg;
+static google::protobuf::Message *msg[NUM_MESSAGES];
static bool initialize()
{
@@ -25,18 +25,20 @@ static bool initialize()
/* Create the DynamicMessage. */
const google::protobuf::Message *dynamic_msg_prototype =
factory.GetPrototype(MESSAGE_CIDENT::descriptor());
- msg = dynamic_msg_prototype->New();
+ for(int i = 0; i < NUM_MESSAGES; i++)
+ msg[i] = dynamic_msg_prototype->New();
return true;
}
static void cleanup()
{
- delete msg;
+ for(int i = 0; i < NUM_MESSAGES; i++)
+ delete msg[i];
}
-static size_t run()
+static size_t run(int i)
{
- if(!msg->ParseFromString(str)) {
+ if(!msg[i%NUM_MESSAGES]->ParseFromString(str)) {
fprintf(stderr, "Error parsing with proto2.\n");
return 0;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback