From 7eb16a55503855d65c49b0a7e356a317c1325515 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 4 Aug 2009 10:12:41 -0700 Subject: Beginnings of a more extensive benchmarking suite. --- benchmark/parsetostruct_proto2_compiled.cc | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 benchmark/parsetostruct_proto2_compiled.cc (limited to 'benchmark/parsetostruct_proto2_compiled.cc') diff --git a/benchmark/parsetostruct_proto2_compiled.cc b/benchmark/parsetostruct_proto2_compiled.cc new file mode 100644 index 0000000..339e184 --- /dev/null +++ b/benchmark/parsetostruct_proto2_compiled.cc @@ -0,0 +1,37 @@ + +#include "main.c" +#include MESSAGE_HFILE +#include +#include +#include +#include + +static std::string str; +MESSAGE_CIDENT msg; + +static bool initialize() +{ + /* Read the message data itself. */ + std::ifstream stream(MESSAGE_FILE); + if(!stream.is_open()) { + fprintf(stderr, "Error opening " MESSAGE_FILE ".\n"); + return false; + } + std::stringstream stringstream; + stringstream << stream.rdbuf(); + str = stringstream.str(); + return true; +} + +static void cleanup() +{ +} + +static size_t run() +{ + if(!msg.ParseFromString(str)) { + fprintf(stderr, "Error parsing with proto2.\n"); + return 0; + } + return str.size(); +} -- cgit v1.2.3