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

Reduce Publisher/Single retry/repeat allocations #2120

Merged
merged 3 commits into from
Mar 1, 2022

Conversation

Scottmitch
Copy link
Member

Motivation:
RepeatWhenSingle was recently introduced and avoids allocating
new Subscribers for each repeat operation. This helps save
object allocation when the operator is used in a loop. We
should use a consistent strategy for existing Publisher/Single
repeat/retry related operators.

Modifications:

  • Redo[When]Publisher and Retry[When]Single no longer allocates
    a new Subscriber on each iteration.
  • All the repeat/retry operators now have consistent behavior
    for AsyncContext map which is to re-use it. Previously a copy
    was made before resubscribing, however the old map is no longer
    used after a terminal event anyways so this shouldn't have any
    benefit. Either we copy the map up front before subscribe, or
    we just re-use the same map and let the async source at the top
    of the chain reset if necessary.

Result:
Less object allocation and consistent AsyncContext behavior for
repeat/retry operators.

Motivation:
RepeatWhenSingle was recently introduced and avoids allocating
new Subscribers for each repeat operation. This helps save
object allocation when the operator is used in a loop. We
should use a consistent strategy for existing Publisher/Single
repeat/retry related operators.

Modifications:
- Redo[When]Publisher and Retry[When]Single no longer allocates
  a new Subscriber on each iteration.
- All the repeat/retry operators now have consistent behavior
  for AsyncContext map which is to re-use it. Previously a copy
  was made before resubscribing, however the old map is no longer
  used after a terminal event anyways so this shouldn't have any
  benefit. Either we copy the map up front before subscribe, or
  we just re-use the same map and let the async source at the top
  of the chain reset if necessary.

Result:
Less object allocation and consistent AsyncContext behavior for
repeat/retry operators.
@Scottmitch
Copy link
Member Author

build failure attributed to #1894

@Scottmitch
Copy link
Member Author

Could not GET 'https://plugins.gradle.org/m2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.pom'. Received status code 503 from server: Service Unavailable

@Scottmitch
Copy link
Member Author

build failure attributed to #2069

@Scottmitch Scottmitch merged commit 70d2a47 into apple:main Mar 1, 2022
@Scottmitch Scottmitch deleted the retry_repeat branch March 1, 2022 21:59
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.

2 participants