From 7b4e376f793eebbf911718974c67008fa3d51429 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 4 Nov 2020 13:43:44 -0800 Subject: [PATCH] Switch unordered_set -> absl::flat_hash_set. --- benchmarks/BUILD | 1 + benchmarks/benchmark.cc | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/benchmarks/BUILD b/benchmarks/BUILD index 45bb870bc2..4ed4042a6c 100644 --- a/benchmarks/BUILD +++ b/benchmarks/BUILD @@ -53,6 +53,7 @@ cc_binary( ":ads_upb_proto_reflection", "//:descriptor_upb_proto", "//:reflection", + "@com_google_absl//absl/container:flat_hash_set", "@com_github_google_benchmark//:benchmark_main", "@com_google_protobuf//:protobuf", ], diff --git a/benchmarks/benchmark.cc b/benchmarks/benchmark.cc index 8921ac7f8b..0fa995d965 100644 --- a/benchmarks/benchmark.cc +++ b/benchmarks/benchmark.cc @@ -2,6 +2,7 @@ #include #include +#include "absl/container/flat_hash_set.h" #include "benchmarks/descriptor.pb.h" #include "benchmarks/descriptor.upb.h" #include "benchmarks/descriptor.upbdefs.h" @@ -18,7 +19,7 @@ char buf[65535]; void CollectFileDescriptors(const upb_def_init* file, std::vector& serialized_files, - std::unordered_set& seen) { + absl::flat_hash_set& seen) { if (!seen.insert(file).second) return; for (upb_def_init **deps = file->deps; *deps; deps++) { CollectFileDescriptors(*deps, serialized_files, seen); @@ -88,7 +89,7 @@ BENCHMARK(BM_LoadDescriptor_Proto2); static void BM_LoadAdsDescriptor_Proto2(benchmark::State& state) { extern upb_def_init google_ads_googleads_v5_services_google_ads_service_proto_upbdefinit; std::vector serialized_files; - std::unordered_set seen_files; + absl::flat_hash_set seen_files; CollectFileDescriptors( &google_ads_googleads_v5_services_google_ads_service_proto_upbdefinit, serialized_files, seen_files);