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

Reduce scheduler serialization overhead #14249

Merged
merged 1 commit into from
Nov 16, 2018
Merged

Conversation

developit
Copy link
Contributor

In the process of switching to MessageChannel, it seems the postMessage call was modified to pass "*" (originally the target origin value from window.postMessage). This actually ends up triggering serialization, whereas passing undefined bypasses.

To save some investigation, passing a Number like 0 still incurs serialization overhead - undefined has special behavior.

In the process of switching to MessageChannel, it seems the postMessage call was modified to pass `"*"` (originally the target origin value from `window.postMessage`). This actually ends up triggering serialization, whereas passing `undefined` bypasses.

To save some investigation, passing a Number like `0` still incurs serialization overhead - `undefined` has special behavior.
@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@sebmarkbage
Copy link
Collaborator

what about passing zero arguments?

@bvaughn
Copy link
Contributor

bvaughn commented Nov 16, 2018

what about passing zero arguments?

postMessage errors if you don't provide exactly 1 argument.

@acdlite
Copy link
Collaborator

acdlite commented Nov 16, 2018

What about null? Would that work? We like to use null if it's intentional.

I'll go ahead and merge, though. Thanks Jason!

@acdlite acdlite merged commit a22fabc into facebook:master Nov 16, 2018
@developit
Copy link
Contributor Author

I admit I hadn't had time to check null. I need to verify with Mathias but I don't think it triggers the bypass. Source is here:
https://cs.chromium.org/chromium/src/third_party/blink/renderer/bindings/core/v8/script_value.h?type=cs&g=0&l=74

@developit developit deleted the patch-1 branch November 16, 2018 19:42
@sophiebits
Copy link
Collaborator

sophiebits commented Nov 16, 2018

I didn’t think IsEmpty would return true for undefined; was this observably faster?

@sebmarkbage
Copy link
Collaborator

@developit For the formality, mind asking to be added to our CLA?

@developit
Copy link
Contributor Author

Yup, working on it!

@sophiebits yes - consistently 5x faster. I'll set up a proper benchmark.

@sophiebits
Copy link
Collaborator

:o

@developit
Copy link
Contributor Author

Update on the CLA - I was told to just sign as an individual, which I've just done.

jetoneza pushed a commit to jetoneza/react that referenced this pull request Jan 23, 2019
In the process of switching to MessageChannel, it seems the postMessage call was modified to pass `"*"` (originally the target origin value from `window.postMessage`). This actually ends up triggering serialization, whereas passing `undefined` bypasses.

To save some investigation, passing a Number like `0` still incurs serialization overhead - `undefined` has special behavior.
n8schloss pushed a commit to n8schloss/react that referenced this pull request Jan 31, 2019
In the process of switching to MessageChannel, it seems the postMessage call was modified to pass `"*"` (originally the target origin value from `window.postMessage`). This actually ends up triggering serialization, whereas passing `undefined` bypasses.

To save some investigation, passing a Number like `0` still incurs serialization overhead - `undefined` has special behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants