-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Subjects fixes performance improvements #652
Merged
Merged
Conversation
This file contains 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
- Common logic composed inside SubjectSubscriptionManager - ReplaySubject does not block while replaying to new subscribers - Added unit tests and fixed behavior while reviewing with @headinthebox compared to Rx.Net - Uses mostly non-blocking approach (I believe it’s all correct, unit and long running tests have been used to prove it. The tests found concurrency problems during development and became stable once I got the design correct. As with all concurrent code I may be missing something.)
- previous commit got non-blocking working but perf tests showed it slow - this commit retains non-blocking but surpasses master branch performance Master branch: 11,947,459 ops/sec This commit: 16,151,174 ops/sec
RxJava-pull-requests #585 SUCCESS |
RxJava-pull-requests #586 SUCCESS |
Wow ... nice performance improvements!
|
I'm going to revert the
The rest of the changes are awesome, thank you! |
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.
Based on PR #651
Improvements upon Ben's excellent work:
SubjectSubscriptionManager.
. This adds +2.340.000 ops/sec on average; total ~ 4.000.000 ops/sec so far.SafeObserver
uses a volatile for the actual Observer which is swapped to anopObserver
if a terminal case occurs. This avoids an atomic get and if statement and adds a +100.000 ops/second on average; total ~4.100.000 ops/sec so far.Bounded version
We have a boundable ReplaySubject in main named
CustomReplaySubject
and PR #649 to improve a bit upon its performance. It might benefit from the changes above as well. It would be more tricky implementation in terms of the replay operation, since the buffer would be in constant virtual index motion (including its start and end), so observers would need to atomically get a value from it whose index could get below the virtual start index of the buffer. Will think about this.