MCPcopy Create free account
hub / github.com/Snapchat/Valdi / DecodeProtobufReflectionCpp

Function DecodeProtobufReflectionCpp

valdi_protobuf/src/benchmark/Benchmark.cpp:58–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56BENCHMARK(DecodeProtobufCpp);
57
58static void DecodeProtobufReflectionCpp(benchmark::State& state) {
59 auto protoData = makeProtoData();
60 google::protobuf::DynamicMessageFactory factory;
61 auto* prototype = factory.GetPrototype(test::Message::GetDescriptor());
62
63 for (auto _ : state) {
64 auto message = prototype->New();
65 if (!message->ParseFromArray(protoData.data(), protoData.size())) {
66 SC_ABORT("Message failed to parse");
67 }
68 }
69}
70BENCHMARK(DecodeProtobufReflectionCpp);
71
72static void EncodeProtobufCpp(benchmark::State& state) {

Callers

nothing calls this directly

Calls 5

makeProtoDataFunction · 0.85
GetDescriptorFunction · 0.85
NewMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected