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.
The default_ua function is called on every request and involves
calls to the slow base function packageDescription. Depending on the
use, this can account for up to 40% of the client-side CPU time which
is a lot when using over a loopback connection (e.g. etcd, RNeo4j).
Because this information is unlikely to change during a session (and is
infomative for the server and likely ignored anyway) computing it once
and reusing it seems safe).
I'm not sure how much you're interested in local performance vs use over network connections (which will dwarf the differences here). Benchmarks vary depending by system; in particular SSD-backed storage suffer much less.
Running HEAD on a locally-running etcd server (which is where I found this issue)
Before:
after:
This can be a lot less pronounced; using Python' simple http server and running on an SSD-based system I see
before
after
(sorry, not really sure why the call traces look so different).