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

ElementAt backpressure improvements #3014

Closed
akarnokd opened this issue Jun 10, 2015 · 1 comment
Closed

ElementAt backpressure improvements #3014

akarnokd opened this issue Jun 10, 2015 · 1 comment

Comments

@akarnokd
Copy link
Member

The operator elementAt could be improved in several ways:

  • It could request index amount upfront so it doesn't have to request(1) at every skipped value
    • this could be achieved with unconditional requesting in onStart() + SingleDelayedProducer or conditionally when the child subscriber actually requests a positive value(i.e., if (n > 0 && once.compareAndSet(false, true)) request(index))
  • Once the required element arrives, one should call this.unsubscribe() in onNext().
    • Note that the parent subscriber can't directly wrap the child subscriber anymore.
  • I'd also do a currentIndex < index check in onError in case an error happens after the indexth element and it slips through.
@akarnokd
Copy link
Member Author

Closed via #3045

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant