diff options
author | 2017-07-27 16:24:15 -0700 | |
---|---|---|
committer | 2017-07-27 19:45:24 -0700 | |
commit | 0133cc6fd8c549151498291e7796b9719502c8c5 (patch) | |
tree | f99adc978339c064f094ddd270d48942fb434028 /test/cpp/qps/server.h | |
parent | 1d27c66d8e06a6f8ca72d1a8cd3c7532f9e20fb4 (diff) |
Avoid benchmarking allocs
Diffstat (limited to 'test/cpp/qps/server.h')
-rw-r--r-- | test/cpp/qps/server.h | 7 |
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; } |