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

2.x: improve request accounting overhead in retry/repeat #5790

Merged
merged 2 commits into from
Jan 5, 2018

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Jan 5, 2018

This PR improves the request accounting overhead in the retry and repeat operators.

Previously, every individual onNext invocation signaled a an item production, which had a lot of overhead since the SubscriptionArbiter has to serialize invocations of setSubscription, request and produced. The improved algorithm counts the onNext calls in a field and calls produced once with the total count before subscribing to the upstream again.

Other small changes:

  • rename inner class to RetrySubscriber (sloppy copy-paste),
  • add isCancelled() check to repeatUntil subscription loop, which was somehow missing.

@codecov
Copy link

codecov bot commented Jan 5, 2018

Codecov Report

Merging #5790 into 2.x will decrease coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #5790      +/-   ##
============================================
- Coverage     96.29%   96.24%   -0.06%     
  Complexity     5809     5809              
============================================
  Files           634      634              
  Lines         41607    41629      +22     
  Branches       5770     5775       +5     
============================================
  Hits          40066    40066              
- Misses          614      626      +12     
- Partials        927      937      +10
Impacted Files Coverage Δ Complexity Δ
...ex/internal/operators/flowable/FlowableRepeat.java 100% <100%> (ø) 3 <0> (ø) ⬇️
...nal/operators/flowable/FlowableRetryPredicate.java 100% <100%> (ø) 2 <0> (ø) ⬇️
...ternal/operators/flowable/FlowableRepeatUntil.java 100% <100%> (ø) 2 <0> (ø) ⬇️
...l/operators/flowable/FlowableRetryBiPredicate.java 100% <100%> (ø) 2 <0> (ø) ⬇️
.../operators/completable/CompletableConcatArray.java 93.75% <0%> (-6.25%) 2% <0%> (ø)
...l/operators/observable/ObservableFlatMapMaybe.java 84.96% <0%> (-5.89%) 2% <0%> (ø)
...in/java/io/reactivex/subjects/BehaviorSubject.java 86.24% <0%> (-5.83%) 54% <0%> (ø)
.../io/reactivex/internal/schedulers/IoScheduler.java 89.24% <0%> (-3.23%) 9% <0%> (ø)
...activex/internal/operators/single/SingleCache.java 97.05% <0%> (-2.95%) 23% <0%> (-1%)
...x/internal/operators/flowable/FlowablePublish.java 92.51% <0%> (-2.65%) 10% <0%> (-1%)
... and 28 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 709ccd6...6c61c69. Read the comment docs.

Copy link
Contributor

@artem-zinnatullin artem-zinnatullin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@akarnokd akarnokd merged commit 4fd16ee into ReactiveX:2.x Jan 5, 2018
@akarnokd akarnokd deleted the RepeatRetryLessOverhead branch January 5, 2018 22:34
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.

3 participants