perf(native): Fix unnecessary copy in http module#27063
Merged
amitkdutta merged 1 commit intoprestodb:masterfrom Feb 3, 2026
Merged
perf(native): Fix unnecessary copy in http module#27063amitkdutta merged 1 commit intoprestodb:masterfrom
amitkdutta merged 1 commit intoprestodb:masterfrom
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefactors parts of the Presto HTTP client and server to eliminate unnecessary copies by moving ownership where appropriate and binding to const references instead of making temporary copies, primarily to satisfy INFERMINICPP lint warnings and improve performance. Class diagram for updated HTTP client and server move semanticsclassDiagram
class HttpClient {
+HttpClient(std__string host, uint16_t port, std__shared_ptr~proxygen__HTTPConnector~ pool, folly__SSLContextPtr sslContext, std__function~void(HttpStats&)~ reportOnBodyStatsFunc)
-std__shared_ptr~proxygen__HTTPConnector~ pool_
-folly__SSLContextPtr sslContext_
-std__function~void(HttpStats&)~ reportOnBodyStatsFunc_
}
class ResponseHandler {
+folly__SemiFuture~std__unique_ptr~HttpResponse~~ initialize(std__shared_ptr~ResponseHandler~ self)
-std__shared_ptr~ResponseHandler~ self_
-folly__Promise~std__unique_ptr~HttpResponse~~ promise_
}
class ConnectionHandler {
+ConnectionHandler(std__shared_ptr~ResponseHandler~ responseHandler, std__shared_ptr~SessionPool~ sessionPool, std__chrono__milliseconds transactionTimeout, std__chrono__milliseconds connectTimeout, bool http2Enabled, uint32_t maxConcurrentStreams, folly__SSLContextPtr sslContext)
-std__shared_ptr~ResponseHandler~ responseHandler_
-std__shared_ptr~SessionPool~ sessionPool_
-folly__HHWheelTimer__UniquePtr transactionTimer_
-std__chrono__milliseconds connectTimeout_
-bool http2Enabled_
-uint32_t maxConcurrentStreams_
}
class CallbackRequestHandlerState {
+static std__shared_ptr~CallbackRequestHandlerState~ create()
+void runOnFinalization(std__function~void(void)~ callback)
-std__function~void(void)~ onFinalizationCallback_
}
class CallbackRequestHandler {
+CallbackRequestHandler(RequestHandlerCallback callback)
+CallbackRequestHandler(AsyncRequestHandlerCallback callback)
-RequestHandlerCallback callback_
-std__shared_ptr~CallbackRequestHandlerState~ state_
-static RequestHandlerCallback wrap(RequestHandlerCallback callback)
}
class DispatchingRequestHandlerFactory {
+proxygen__RequestHandler* onRequest(proxygen__RequestHandler* request, proxygen__HTTPMessage* message)
}
HttpClient --> ResponseHandler
ResponseHandler --> ConnectionHandler
ConnectionHandler --> HttpClient
CallbackRequestHandler --> CallbackRequestHandlerState
DispatchingRequestHandlerFactory --> CallbackRequestHandler
DispatchingRequestHandlerFactory --> HttpClient
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
7288a78 to
41028e2
Compare
amitkdutta
added a commit
to amitkdutta/presto
that referenced
this pull request
Feb 1, 2026
Summary: Fix INFERMINICPP lint warnings for unnecessary copies in the Presto HTTP module: - Use std::move() for shared_ptr, SSLContextPtr, and callback assignments - Use const reference for path variable to avoid copy from getPath() These changes eliminate unnecessary copy operations and improve performance. Differential Revision: D91994719
amitkdutta
added a commit
to amitkdutta/presto
that referenced
this pull request
Feb 1, 2026
Summary: Fix INFERMINICPP lint warnings for unnecessary copies in the Presto HTTP module: - Use std::move() for shared_ptr, SSLContextPtr, and callback assignments - Use const reference for path variable to avoid copy from getPath() These changes eliminate unnecessary copy operations and improve performance. Differential Revision: D91994719
41028e2 to
3326c1e
Compare
amitkdutta
added a commit
to amitkdutta/presto
that referenced
this pull request
Feb 1, 2026
Summary: Fix INFERMINICPP lint warnings for unnecessary copies in the Presto HTTP module: - Use std::move() for shared_ptr, SSLContextPtr, and callback assignments - Use const reference for path variable to avoid copy from getPath() These changes eliminate unnecessary copy operations and improve performance. Differential Revision: D91994719
3326c1e to
8aee84d
Compare
kewang1024
approved these changes
Feb 1, 2026
amitkdutta
added a commit
to amitkdutta/presto
that referenced
this pull request
Feb 2, 2026
Summary: Fix INFERMINICPP lint warnings for unnecessary copies in the Presto HTTP module: - Use std::move() for shared_ptr, SSLContextPtr, and callback assignments - Use const reference for path variable to avoid copy from getPath() These changes eliminate unnecessary copy operations and improve performance. Differential Revision: D91994719
8aee84d to
f28de61
Compare
Summary: Fix INFERMINICPP lint warnings for unnecessary copies in the Presto HTTP module: - Use std::move() for shared_ptr, SSLContextPtr, and callback assignments - Use const reference for path variable to avoid copy from getPath() These changes eliminate unnecessary copy operations and improve performance. Differential Revision: D91994719
f28de61 to
77e3b1f
Compare
This was referenced Mar 31, 2026
15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Fix unnecessary copies in the Presto HTTP module:
These changes eliminate unnecessary copy operations and improve performance.
Summary by Sourcery
Address performance-related cleanups in the Presto HTTP client and server by eliminating unnecessary copies of objects and strings.
Enhancements: