Added benchmark to show static vs copied

pull/10109/head
ncteisen 8 years ago
parent 4b36a3d9ea
commit 91220dc793
  1. 13
      test/cpp/microbenchmarks/bm_error.cc

@ -51,14 +51,23 @@ class ErrorDeleter {
};
typedef std::unique_ptr<grpc_error, ErrorDeleter> ErrorPtr;
static void BM_ErrorCreate(benchmark::State& state) {
static void BM_ErrorCreateFromStatic(benchmark::State& state) {
TrackCounters track_counters;
while (state.KeepRunning()) {
GRPC_ERROR_UNREF(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Error"));
}
track_counters.Finish(state);
}
BENCHMARK(BM_ErrorCreate);
BENCHMARK(BM_ErrorCreateFromStatic);
static void BM_ErrorCreateFromCopied(benchmark::State& state) {
TrackCounters track_counters;
while (state.KeepRunning()) {
GRPC_ERROR_UNREF(GRPC_ERROR_CREATE_FROM_COPIED_STRING("Error not inline"));
}
track_counters.Finish(state);
}
BENCHMARK(BM_ErrorCreateFromCopied);
static void BM_ErrorCreateAndSetStatus(benchmark::State& state) {
TrackCounters track_counters;

Loading…
Cancel
Save