Skip to content

Commit c672966

Browse files
yuandagitsfacebook-github-bot
authored andcommitted
Avoid a copy in response builder
Summary: We're calling `folly::to<std::string>` and passing the output of that into maybeCopyBuffer. Instead, we can use `folly::IOBuf::fromString` which will destructively consume the string wp post: https://fb.workplace.com/groups/218959637537866/permalink/3534280696879296/ Reviewed By: hanidamlaj, NikhilCollooru Differential Revision: D73537785 fbshipit-source-id: 36abbb3dc7ca00189f36bfd1f782ac6dd8cc2125
1 parent 341e2ed commit c672966

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

proxygen/httpserver/ResponseBuilder.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ class ResponseBuilder {
117117

118118
template <typename T>
119119
ResponseBuilder& body(T&& t) {
120-
return body(folly::IOBuf::maybeCopyBuffer(
121-
folly::to<std::string>(std::forward<T>(t))));
120+
return body(
121+
folly::IOBuf::fromString(folly::to<std::string>(std::forward<T>(t))));
122122
}
123123

124124
ResponseBuilder& closeConnection() {

0 commit comments

Comments
 (0)