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

debounceTime performance when having large amounts of updates #6045

Closed
voliva opened this issue Feb 23, 2021 · 1 comment
Closed

debounceTime performance when having large amounts of updates #6045

voliva opened this issue Feb 23, 2021 · 1 comment
Assignees

Comments

@voliva
Copy link
Contributor

voliva commented Feb 23, 2021

RxJS version:
6 and 7

Code to reproduce:
https://codesandbox.io/s/practical-poincare-gm0h6?file=/src/index.ts

It presents a stream with 100.000 updates, and two buttons to try two posibilities: use debounceTime from rxjs or use a custom (not finished) implementation that works with just one setTimeout

Expected behavior:
RxJS test takes a constant time, just like the custom implementation

Actual behavior:
RxJS test takes a linear time based on number of updates

Additional information:

There's a bit of discussion around debounce in #2834 and I can see that the implementation is not as straightforward as in the custom one, as there's an scheduler.

However, it should be posible to not cancel the task and re-create it on every message received, but use something similar to the custom implementation so that when the last task evaluates, it checks whether it needs to set up a new task or it can emit the last value straight away.

I think it's important to decrease the overhead of ignored messages, as one of the main points of debounceTime is to prevent processing quick succession of events.

I'm happy to contribute on this if you need some help.

@cartant
Copy link
Collaborator

cartant commented Feb 25, 2021

Closed by #6049

@cartant cartant closed this as completed Feb 25, 2021
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

No branches or pull requests

3 participants