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