Skip to content

Improve performance of drop() #4

Open

Description

@MartinMalinda

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 });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions