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 });
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()
andcomputed()
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()
.