aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-07-27 16:24:15 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2017-07-27 19:45:24 -0700
commit0133cc6fd8c549151498291e7796b9719502c8c5 (patch)
treef99adc978339c064f094ddd270d48942fb434028 /test/cpp/qps
parent1d27c66d8e06a6f8ca72d1a8cd3c7532f9e20fb4 (diff)
Avoid benchmarking allocs
Diffstat (limited to 'test/cpp/qps')
-rw-r--r--test/cpp/qps/server.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h
index c0dac96d8b..df27a4368e 100644
--- a/test/cpp/qps/server.h
+++ b/test/cpp/qps/server.h
@@ -80,8 +80,11 @@ class Server {
return false;
}
payload->set_type(type);
- std::unique_ptr<char[]> body(new char[size]());
- payload->set_body(body.get(), size);
+ // Don't waste time creating a new payload of identical size.
+ if (payload->body().length() != (size_t)size) {
+ std::unique_ptr<char[]> body(new char[size]());
+ payload->set_body(body.get(), size);
+ }
return true;
}