From 7ace14c513f23698c693efca73b24c143fd077ad Mon Sep 17 00:00:00 2001 From: Hong Shin Date: Wed, 11 Sep 2024 08:05:26 -0700 Subject: [PATCH] Abrogate protos::Arena with hpb::Arena PiperOrigin-RevId: 673395989 --- hpb/BUILD | 1 + hpb/hpb.h | 2 +- protos/protos.h | 1 - rust/test/benchmarks/BUILD | 3 ++- rust/test/benchmarks/rust_protobuf_benchmarks.cc | 8 ++++---- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hpb/BUILD b/hpb/BUILD index 30429894e0..d5e2ddd00b 100644 --- a/hpb/BUILD +++ b/hpb/BUILD @@ -30,6 +30,7 @@ cc_library( defines = ["HPB_BACKEND_UPB"], visibility = ["//visibility:public"], deps = [ + "//hpb:arena", "//hpb:extension", "//hpb:ptr", "//hpb/backend/upb", diff --git a/hpb/hpb.h b/hpb/hpb.h index 7c67a4f320..66ed1b6dd7 100644 --- a/hpb/hpb.h +++ b/hpb/hpb.h @@ -15,6 +15,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" +#include "google/protobuf/hpb/arena.h" #include "google/protobuf/hpb/backend/upb/interop.h" #include "google/protobuf/hpb/extension.h" #include "google/protobuf/hpb/internal/internal.h" @@ -35,7 +36,6 @@ namespace hpb { class ExtensionRegistry; -using Arena = ::upb::Arena; // TODO: b/354766950 - Move upb-specific chunks out of hpb header inline absl::string_view UpbStrToStringView(upb_StringView str) { diff --git a/protos/protos.h b/protos/protos.h index 44477dd759..25faab2fa7 100644 --- a/protos/protos.h +++ b/protos/protos.h @@ -8,6 +8,5 @@ #define UPB_PROTOS_PROTOS_H_ #include "google/protobuf/hpb/hpb.h" namespace protos { -using hpb::Arena; } // namespace protos #endif diff --git a/rust/test/benchmarks/BUILD b/rust/test/benchmarks/BUILD index 6a1e2294a9..694feb38da 100644 --- a/rust/test/benchmarks/BUILD +++ b/rust/test/benchmarks/BUILD @@ -49,8 +49,8 @@ cc_test( ":benchmarks", ":proto_benchmarks_cpp", # build_cleaner: keep "//hpb", + "//hpb:arena", "//hpb:repeated_field", - "//protos", "//src/google/protobuf:protobuf_lite", "//testing/base/public:gunit", "//third_party/benchmark", @@ -71,6 +71,7 @@ cc_test( ":benchmarks", ":proto_benchmarks_upb", # build_cleaner: keep "//hpb", + "//hpb:arena", "//hpb:repeated_field", "//protos", "//src/google/protobuf:protobuf_lite", diff --git a/rust/test/benchmarks/rust_protobuf_benchmarks.cc b/rust/test/benchmarks/rust_protobuf_benchmarks.cc index 1a1bcf04f9..2da1b91338 100644 --- a/rust/test/benchmarks/rust_protobuf_benchmarks.cc +++ b/rust/test/benchmarks/rust_protobuf_benchmarks.cc @@ -5,11 +5,11 @@ #include #include "absl/log/absl_check.h" +#include "google/protobuf/hpb/arena.h" #include "google/protobuf/hpb/hpb.h" #include "google/protobuf/repeated_ptr_field.h" #include "google/protobuf/rust/test/benchmarks/bench_data.pb.h" #include "google/protobuf/rust/test/benchmarks/bench_data.upb.proto.h" -#include "protos/protos.h" using benchmarks::BenchData; @@ -142,7 +142,7 @@ BENCHMARK(BM_add_100_ints_cpp); void BM_add_100_ints_upb(benchmark::State& state) { for (auto s : state) { - ::protos::Arena arena; + hpb::Arena arena; auto data = ::hpb::CreateMessage(arena); for (int i = 0; i < 100; ++i) { data.add_nums(i); @@ -184,7 +184,7 @@ void BM_copy_from_100_ints_cpp(benchmark::State& state) { BENCHMARK(BM_copy_from_100_ints_cpp); void BM_copy_from_100_ints_upb(benchmark::State& state) { - ::protos::Arena arena; + hpb::Arena arena; auto source = ::hpb::CreateMessage(arena); for (int i = 0; i < 100; ++i) { source.add_nums(i); @@ -228,7 +228,7 @@ void BM_sum_1000_ints_cpp(benchmark::State& state) { BENCHMARK(BM_sum_1000_ints_cpp); void BM_sum_1000_ints_upb(benchmark::State& state) { - ::protos::Arena arena; + hpb::Arena arena; auto data = ::hpb::CreateMessage(arena); for (int i = 0; i < 1000; ++i) { data.add_nums(i);