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

Improve performance of drop() #4

Open
MartinMalinda opened this issue May 22, 2020 · 0 comments
Open

Improve performance of drop() #4

MartinMalinda opened this issue May 22, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@MartinMalinda
Copy link
Owner

MartinMalinda commented May 22, 2020

These optimizations might be useful if the task is used very extensively, on scroll or raf or smilar (intense throttling).

Task is being marked as drop after quite some work of creating a new reactive object. Dropped task instance never changes though and all the set up of reactive() and computed() is not needed.

A simple static object that implements the TaskInterface could be returned right away.


Alternatively, a task could be set up not to even create dropped task instances and just early return from perform().

// for those who are brave
const task = useTask(function * () { /* ... */ }).drop({ void: true });
@MartinMalinda MartinMalinda added the enhancement New feature or request label Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant