aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/microbenchmarks/bm_error.cc
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-03-13 21:18:58 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2017-03-13 21:18:58 -0700
commit91220dc7932ab4e7f3e924e736b61911d3c420e3 (patch)
tree855f6a305969bc9289e8eb1fd55eb59923ef5071 /test/cpp/microbenchmarks/bm_error.cc
parent4b36a3d9eaaab2f39dcebfcd47f48185be158b49 (diff)
Added benchmark to show static vs copied
Diffstat (limited to 'test/cpp/microbenchmarks/bm_error.cc')
-rw-r--r--test/cpp/microbenchmarks/bm_error.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/cpp/microbenchmarks/bm_error.cc b/test/cpp/microbenchmarks/bm_error.cc
index cd7644c75d..00e1a08cab 100644
--- a/test/cpp/microbenchmarks/bm_error.cc
+++ b/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;