| 88 | BENCHMARK(EncodeProtobufCpp); |
| 89 | |
| 90 | static void EncodeProtobufReflectionCpp(benchmark::State& state) { |
| 91 | auto protoData = makeProtoData(); |
| 92 | google::protobuf::DynamicMessageFactory factory; |
| 93 | auto* prototype = factory.GetPrototype(test::Message::GetDescriptor()); |
| 94 | auto message = prototype->New(); |
| 95 | if (!message->ParseFromArray(protoData.data(), protoData.size())) { |
| 96 | SC_ABORT("Message failed to parse"); |
| 97 | } |
| 98 | |
| 99 | for (auto _ : state) { |
| 100 | auto buffer = makeShared<ByteBuffer>(); |
| 101 | buffer->resize(message->ByteSizeLong()); |
| 102 | |
| 103 | if (!message->SerializeToArray(buffer->data(), buffer->size())) { |
| 104 | SC_ABORT("Message failed to serialize"); |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | BENCHMARK(EncodeProtobufReflectionCpp); |
| 109 | |
| 110 | static void DecodeValdiProtobuf(benchmark::State& state) { |
nothing calls this directly
no test coverage detected