Skip to content

Reduce scheduler serialization overhead - #14249

Merged
acdlite merged 1 commit into
react:masterfrom
developit:patch-1
Nov 16, 2018
Merged

acdlite merged 1 commit into
react:masterfrom
developit:patch-1

Conversation

@developit

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

what about passing zero arguments?

@bvaughn

bvaughn commented Nov 16, 2018

Copy link
Copy Markdown
Contributor

what about passing zero arguments?

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

@acdlite

acdlite commented Nov 16, 2018

Copy link
Copy Markdown
Collaborator

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 react:master Nov 16, 2018
@developit

Copy link
Copy Markdown
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

sophiebits commented Nov 16, 2018 •

Copy link
Copy Markdown
Collaborator

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

@sebmarkbage

Copy link
Copy Markdown
Contributor

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

@developit

Copy link
Copy Markdown
Contributor Author

Yup, working on it!

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

@sophiebits

Copy link
Copy Markdown
Collaborator

:o

@developit

Copy link
Copy Markdown
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.
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
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.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
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