Abrogate protos::Arena with hpb::Arena

PiperOrigin-RevId: 673395989
pull/18190/head
Hong Shin 3 months ago committed by Copybara-Service
parent 13cf397e1a
commit 7ace14c513
  1. 1
      hpb/BUILD
  2. 2
      hpb/hpb.h
  3. 1
      protos/protos.h
  4. 3
      rust/test/benchmarks/BUILD
  5. 8
      rust/test/benchmarks/rust_protobuf_benchmarks.cc

@ -30,6 +30,7 @@ cc_library(
defines = ["HPB_BACKEND_UPB"],
visibility = ["//visibility:public"],
deps = [
"//hpb:arena",
"//hpb:extension",
"//hpb:ptr",
"//hpb/backend/upb",

@ -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) {

@ -8,6 +8,5 @@
#define UPB_PROTOS_PROTOS_H_
#include "google/protobuf/hpb/hpb.h"
namespace protos {
using hpb::Arena;
} // namespace protos
#endif

@ -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",

@ -5,11 +5,11 @@
#include <benchmark/benchmark.h>
#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<benchmarks::protos::BenchData>(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<benchmarks::protos::BenchData>(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<benchmarks::protos::BenchData>(arena);
for (int i = 0; i < 1000; ++i) {
data.add_nums(i);

Loading…
Cancel
Save