Skip to content

2.x: perf change wait to spin-loop for short async benchmarks #3354

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

Merged
merged 1 commit into from
Sep 18, 2015

Conversation

akarnokd
Copy link
Member

I've noticed that the times = 1 async range sometimes produces double the throughput without any change to the underlying structure and I've figured out it is because how my operation system wakes up the await in the benchmark. I switched the tests to spin-loop and now I get a consistent and higher value than before:

image

There are a few light-greens and a few light-reds which I attribute to other fluctuating factors on my computer.

In addition, I've experimented with two optimizations: one for observing a scalar value on a different thread and one where the OperatorObserveOn is turned into a PublisherObserveOn to save on the allocation of a PublisherLift. The scalar optimization ended up being slower by 15% for some reason I don't understand and the PublishObserveOn had no impact on the throughput within the error range.

@akarnokd akarnokd added this to the 2.0 milestone Sep 18, 2015
akarnokd added a commit that referenced this pull request Sep 18, 2015
2.x: perf change wait to spin-loop for short async benchmarks
@akarnokd akarnokd merged commit ba06df5 into ReactiveX:2.x Sep 18, 2015
@akarnokd akarnokd deleted the PerfAwaitFix2x branch September 18, 2015 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant