Skip to content
Snippets Groups Projects
Commit 80b688b3 authored by Noah Eisen's avatar Noah Eisen Committed by GitHub
Browse files

Merge pull request #11959 from ncteisen/qps-opt

Avoid Benchmarking Allocs
parents cace6a9e 0133cc6f
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment