-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feat(runtime/worker): Structured cloning worker message passing. #9323
Conversation
Thanks for the PR, but the current design is on purpose. I'd rather not change code before there's a working prototype of structured cloned message passing and currently we're still missing appropriate bindings in
It's not a good idea to throw such unrelated changes into a PR. Besides current formatting and linting passes so I'm not sure how that's better. |
Thank you for the feedback! I reverted the linting changes. Also, I will change the goal of this PR to create a structured cloning prototype. Like you said, that will make it easier to discuss what can be done better/ differently in my approach. While still making structured cloning work. Will update soon. |
@bartlomieju I pushed a full prototype, please let me know what you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@inteon great work! There's a lot going on in this PR and it might be hard to land it in one go. Changes to core/
look great, there are a few minor comments I have.
I'm yet to properly go through changes to worker implementation; could you open a new PR with only changes to the core/
directory so we can land them first?
@inteon let me know if this PR is ready, I don't think we'll land it for 1.8 though |
Indeed, let's not rush things. First lets make sure it works well. |
@inteon please rebase when you get a moment, let's land this feature for 1.10 |
@bartlomieju |
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@inteon thank you so much for this PR, it's really great that you managed to implement all of that functionality in so little code. I have only some minor/nitpicky comments, other than that it's ready to land. Great to see this landed for 1.10!
I optimized the worker <-> host message passing ops (removed all places where buffers were copied). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well ✅ thanks for seeing this through @inteon, this is a massive feature that was highly requested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thank you much @inteon !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…land#9323) This commit upgrade "Worker.postMessage()" implementation to use structured clone algorithm instead of non-spec compliant JSON serialization.
Refactored webworkers to listen for host messages via an "async bin op" instead of directly injecting JSON into the runtime.
Fixes #3557.