Skip to content
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

Use MessageChannel instead of setTimeout to avoid processing delays #8673

Merged
merged 2 commits into from
Aug 22, 2019

Conversation

kkaefer
Copy link
Member

@kkaefer kkaefer commented Aug 22, 2019

Fixes #8671.

It works around the setTimeout caveats in IE (in my analysis, I found that setTimeout sometimes took more than 30 milliseconds just to execute the next call!) by switch to the universally supported MessageChannel objects. It's normally used to communicate between two different contexts, but you can also use it to "communicate" between the same context. It solves the performance regression reported in #8671 while maintaining the faster cancellation processing from #8633 by decoupling the messages sent from the counterpart from processing: it throttles the postMessage calls it receives from the sender to just one pending postMessage. This is essentially what setTimeout(..., 0) does too.

@kkaefer kkaefer requested review from ahk, arindam1993 and mourner August 22, 2019 09:02
@kkaefer kkaefer self-assigned this Aug 22, 2019
@kkaefer kkaefer added this to the release-queso milestone Aug 22, 2019
@kkaefer kkaefer added the skip changelog Used for PRs that do not need a changelog entry label Aug 22, 2019
Copy link
Member

@mourner mourner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that the builds ran, looks like we need a MessageChannel fallback for Node.

also adds a fallback for environments that don't support MessageChannel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 release blocker ⛔ skip changelog Used for PRs that do not need a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

release-queso: Performance regression in "Animate a point" example
2 participants