| 70 | BENCHMARK(DecodeProtobufReflectionCpp); |
| 71 | |
| 72 | static void EncodeProtobufCpp(benchmark::State& state) { |
| 73 | auto protoData = makeProtoData(); |
| 74 | auto message = makeShared<test::Message>(); |
| 75 | if (!message->ParseFromArray(protoData.data(), protoData.size())) { |
| 76 | SC_ABORT("Message failed to parse"); |
| 77 | } |
| 78 | |
| 79 | for (auto _ : state) { |
| 80 | auto buffer = makeShared<ByteBuffer>(); |
| 81 | buffer->resize(message->ByteSizeLong()); |
| 82 | |
| 83 | if (!message->SerializeToArray(buffer->data(), buffer->size())) { |
| 84 | SC_ABORT("Message failed to serialize"); |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | BENCHMARK(EncodeProtobufCpp); |
| 89 | |
| 90 | static void EncodeProtobufReflectionCpp(benchmark::State& state) { |
nothing calls this directly
no test coverage detected