Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random optimizations #1797

Merged
merged 2 commits into from
Nov 16, 2021
Merged

Random optimizations #1797

merged 2 commits into from
Nov 16, 2021

Conversation

jagerman
Copy link
Member

@jagerman jagerman commented Nov 9, 2021

Reduce some hotspots revealed in profiling.

We have a few cases where we're making an extra shared_ptr which we copy
into a lambda, which then results in an extra unnecessary refcount
decrement in the parent; this changes them to give an rvalue reference
to the lambda to avoid the extra incr/decr instead.

The one in Session::Pump is particularly noticeable and shows up in
profiling.
We are calling time_now() a huge amount, and it is a major consumer of
CPU cycles, but we don't need it: most of the time the current event
loop time is enough.
@majestrate majestrate merged commit b95e53d into oxen-io:dev Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants