diff --git a/tests/benchmark.cc b/tests/benchmark.cc index 5fb99e6147..c608572764 100644 --- a/tests/benchmark.cc +++ b/tests/benchmark.cc @@ -73,7 +73,7 @@ static void BM_LoadDescriptor_Proto2(benchmark::State& state) { } BENCHMARK(BM_LoadDescriptor_Proto2); -static void BM_ParseDescriptor_Upb(benchmark::State& state) { +static void BM_Parse_Upb_FileDesc_WithArena(benchmark::State& state) { size_t bytes = 0; for (auto _ : state) { upb_arena* arena = upb_arena_new(); @@ -89,9 +89,9 @@ static void BM_ParseDescriptor_Upb(benchmark::State& state) { } state.SetBytesProcessed(state.iterations() * descriptor.size); } -BENCHMARK(BM_ParseDescriptor_Upb); +BENCHMARK(BM_Parse_Upb_FileDesc_WithArena); -static void BM_ParseDescriptor_Upb_LargeInitialBlock(benchmark::State& state) { +static void BM_Parse_Upb_FileDesc_WithInitialBlock(benchmark::State& state) { size_t bytes = 0; for (auto _ : state) { upb_arena* arena = upb_arena_init(buf, sizeof(buf), NULL); @@ -107,7 +107,7 @@ static void BM_ParseDescriptor_Upb_LargeInitialBlock(benchmark::State& state) { } state.SetBytesProcessed(state.iterations() * descriptor.size); } -BENCHMARK(BM_ParseDescriptor_Upb_LargeInitialBlock); +BENCHMARK(BM_Parse_Upb_FileDesc_WithInitialBlock); template struct NoArena { @@ -128,9 +128,9 @@ struct WithArena { }; template -struct WithArenaInitialBlock { +struct WithInitialBlock { public: - WithArenaInitialBlock() : arena_(GetOptions()) {} + WithInitialBlock() : arena_(GetOptions()) {} P* GetProto() { return protobuf::Arena::CreateMessage

(&arena_); } private: @@ -144,12 +144,12 @@ struct WithArenaInitialBlock { protobuf::Arena arena_; }; -using FileDescriptor = ::upb_benchmark::FileDescriptorProto; -using FileDescriptorSV = ::upb_benchmark::sv::FileDescriptorProto; +using FileDesc = ::upb_benchmark::FileDescriptorProto; +using FileDescSV = ::upb_benchmark::sv::FileDescriptorProto; const protobuf::MessageLite::ParseFlags kMergePartial = protobuf::MessageLite::ParseFlags::kMergePartial; -const protobuf::MessageLite::ParseFlags kMergePartialWithAliasing = +const protobuf::MessageLite::ParseFlags kAliasStrings = protobuf::MessageLite::ParseFlags::kMergePartialWithAliasing; template class Factory, @@ -169,15 +169,15 @@ void BM_Parse_Proto2(benchmark::State& state) { } state.SetBytesProcessed(state.iterations() * descriptor.size); } -BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescriptor, NoArena); -BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescriptor, WithArena); -BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescriptor, WithArenaInitialBlock); -//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescriptorSV, NoArena); -//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescriptorSV, WithArena); -BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescriptorSV, WithArenaInitialBlock); -//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescriptorSV, NoArena, kMergePartialWithAliasing); -//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescriptorSV, WithArena, kMergePartialWithAliasing); -BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescriptorSV, WithArenaInitialBlock, kMergePartialWithAliasing); +BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDesc, NoArena); +BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDesc, WithArena); +BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDesc, WithInitialBlock); +//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, NoArena); +//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, WithArena); +BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, WithInitialBlock); +//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, NoArena, kAliasStrings); +//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, WithArena, kAliasStrings); +BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, WithInitialBlock, kAliasStrings); static void BM_SerializeDescriptor_Proto2(benchmark::State& state) { size_t bytes = 0;