Repository navigation
Allow to avoid a string copy in string_response constructor - #201
Merged
etr merged 1 commit intoJul 22, 2020
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #201 +/- ##
=======================================
Coverage 95.63% 95.63%
=======================================
Files 35 35
Lines 3230 3230
=======================================
Hits 3089 3089
Misses 141 141
Continue to review full report at Codecov.
|
Owner
|
No worries for the tests - appveyor and travis have run them. Thanks for the help! |
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.
Description of the Change
For the
string_responseconstructor, instead of using a const reference, pass the string content by value (hence can be moved into) and move it into thecontentfield. This allow to avoid a copy by doing things likeQuantitative Performance Benefits
I ran benchmarks with gatling against my own application using libhttpserver as a frontend for the application backed by a mongo DB. Each run is 60 seconds. Used 10k and 10MB responses. Between 10 and 50 gatling clients. Performance gain is 3% to 5% depending on the setup.
If you have a standard way to run benchmarks I would be happy to run those.
Possible Drawbacks
I don't see any drawbacks.
Verification Process
It passes my own test suites. Sorry I was unable to run libhttpserver tests, I got unexpected errors when running
make check, e.gundefined reference to httpserver::resource_init...Release Notes
Slight performances improvement by allowing to skip a copy in string_response constructor.