update benchmark.cc from v7 to v11 of the google ads proto

PiperOrigin-RevId: 455675163
pull/13171/head
Protobuf Team Bot 3 years ago committed by Copybara-Service
parent 65bde4e75b
commit 88047d90ba
  1. 2
      benchmarks/BUILD.googleapis
  2. 17
      benchmarks/benchmark.cc

@ -31,7 +31,7 @@ load(
proto_library(
name = "ads_proto",
srcs = glob([
"google/ads/googleads/v7/**/*.proto",
"google/ads/googleads/v11/**/*.proto",
"google/api/**/*.proto",
"google/rpc/**/*.proto",
"google/longrunning/**/*.proto",

@ -24,16 +24,17 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <benchmark/benchmark.h>
#include <string.h>
#include "google/ads/googleads/v11/services/google_ads_service.upbdefs.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/dynamic_message.h"
#include "absl/container/flat_hash_set.h"
#include "benchmarks/descriptor.pb.h"
#include "benchmarks/descriptor.upb.h"
#include "benchmarks/descriptor.upbdefs.h"
#include "benchmarks/descriptor_sv.pb.h"
#include "google/ads/googleads/v7/services/google_ads_service.upbdefs.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/dynamic_message.h"
#include "upb/def.hpp"
upb_StringView descriptor = benchmarks_descriptor_proto_upbdefinit.descriptor;
@ -137,14 +138,14 @@ static void BM_LoadAdsDescriptor_Upb(benchmark::State& state) {
for (auto _ : state) {
upb::SymbolTable symtab;
if (Mode == NoLayout) {
google_ads_googleads_v7_services_SearchGoogleAdsRequest_getmsgdef(
google_ads_googleads_v11_services_SearchGoogleAdsRequest_getmsgdef(
symtab.ptr());
bytes_per_iter = _upb_DefPool_BytesLoaded(symtab.ptr());
} else {
bytes_per_iter = 0;
LoadDefInit_BuildLayout(
symtab.ptr(),
&google_ads_googleads_v7_services_google_ads_service_proto_upbdefinit,
&google_ads_googleads_v11_services_google_ads_service_proto_upbdefinit,
&bytes_per_iter);
}
}
@ -156,11 +157,11 @@ BENCHMARK_TEMPLATE(BM_LoadAdsDescriptor_Upb, WithLayout);
template <LoadDescriptorMode Mode>
static void BM_LoadAdsDescriptor_Proto2(benchmark::State& state) {
extern _upb_DefPool_Init
google_ads_googleads_v7_services_google_ads_service_proto_upbdefinit;
google_ads_googleads_v11_services_google_ads_service_proto_upbdefinit;
std::vector<upb_StringView> serialized_files;
absl::flat_hash_set<const _upb_DefPool_Init*> seen_files;
CollectFileDescriptors(
&google_ads_googleads_v7_services_google_ads_service_proto_upbdefinit,
&google_ads_googleads_v11_services_google_ads_service_proto_upbdefinit,
serialized_files, seen_files);
size_t bytes_per_iter = 0;
for (auto _ : state) {
@ -183,7 +184,7 @@ static void BM_LoadAdsDescriptor_Proto2(benchmark::State& state) {
if (Mode == WithLayout) {
protobuf::DynamicMessageFactory factory;
const protobuf::Descriptor* d = pool.FindMessageTypeByName(
"google.ads.googleads.v7.services.SearchGoogleAdsResponse");
"google.ads.googleads.v11.services.SearchGoogleAdsResponse");
if (!d) {
printf("Failed to find descriptor.\n");
exit(1);

Loading…
Cancel
Save