-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add support for Web Workers #142
Comments
As I said at the WG, I'm not sure longtasks are the right abstraction for this use case. Perhaps what is needed here is a more ergonomic way to report about work times to the worker's client, e.g. start and end time of processing a onmessage = event => {
fetch(event.data)
.then(() => {
// This executes in a new task, not created by `postMessage`
});
} Alternatively, perhaps some use cases for workers could benefit from a higher level scheduling API, that would make them more "special purpose" and thus benefit from prioritization and breaking tasks. One precedent for this is offscreen canvas and calling |
I'm working on another explainer to monitor end-to-end handling of |
@joone for the canvas case, we should definitely use LoAF and not longtasks. |
@noamr, in this offscreen canvas example, long tasks can be randomly executed within the rendering code, affecting the box update, but LoAF is not appliable in this scenario. https://joone.github.io/web/game_worker/ If we support the Long Tasks API in Web Workers, it can identify long tasks in this case. If you're okay with supporting |
Why is it not applicable? Can you expand?
Not convinced yet that long tasks help identifying or acting on any issues with workers. |
In the demo above, you can move the box using the cursor keys, but it is sluggish due to the Fibonacci function call in the gameLoop(). This issue cannot be identified by the LoAF API. |
Why not? If LoAF was supporting workers (instead of long tasks) it should catch that. |
I hadn't thought about supporting LoAF for Web Workers. If we do, it could help identify the issue. |
I propose extending the TaskAttributionTiming interface to support Web Workers. This extension would provide details about long tasks and their associated Web Workers.
The text was updated successfully, but these errors were encountered: