Bug 1706357 Comment 9 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to Yoshi Cheng-Hao Huang [:allstars.chh][:allstarschh] from comment #8)
> Yes, it will be spinning, but the spinning time shouldn't be too long, and this is just the first step to integrate with TaskController.

Can we avoid dispatching tasks to the controler until they are ready to run?  Dispatching tasks only to have them spinning is wasteful of CPU resources and something we want to avoid.  I understand this is only the first step, but this is an important aspect to figure out.

> The main idea is to refactor GlobalHelperThreadState (this bug) and update the interface (bug 1704923) so we can do more experiments and more elaborations with TaskController, and we still dispatch to our existing HelperThreads by default (bug 1703240) so it shouldn't break any existing behavior.
> So with these patches from those bugs, for a off-thread Task, whether it's run from our internal HelperThread, or from an external XPCOM thread, they both call (almost) the same functions: isTaskQueueEmpty(), checkTaskThreadLimit, getTask, and runHelperThreadLocked, this should help us maintaining easier.

I agree with all of this.
(In reply to Yoshi Cheng-Hao Huang [:allstars.chh][:allstarschh] from comment #8)
> Yes, it will be spinning, but the spinning time shouldn't be too long, and this is just the first step to integrate with TaskController.

Can we avoid dispatching tasks to the controller until they are ready to run?  Dispatching tasks only to have them spinning is wasteful of CPU resources and something we want to avoid.  I understand this is only the first step, but this is an important aspect to figure out.

> The main idea is to refactor GlobalHelperThreadState (this bug) and update the interface (bug 1704923) so we can do more experiments and more elaborations with TaskController, and we still dispatch to our existing HelperThreads by default (bug 1703240) so it shouldn't break any existing behavior.
> So with these patches from those bugs, for a off-thread Task, whether it's run from our internal HelperThread, or from an external XPCOM thread, they both call (almost) the same functions: isTaskQueueEmpty(), checkTaskThreadLimit, getTask, and runHelperThreadLocked, this should help us maintaining easier.

I agree with all of this.

Back to Bug 1706357 Comment 9