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

Inform DevTools of commit priority level #15664

Merged
merged 4 commits into from
May 20, 2019

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented May 15, 2019

React now informs DevTools of the commit priority level (so the Profiler can display and potentially filter on the info).

Demo

priority-Kapture 2019-05-15 at 15 21 57

@sizebot
Copy link

sizebot commented May 15, 2019

ReactDOM: size: -0.0%, gzip: -0.0%

Details of bundled changes.

Comparing: 0bd9b5d...4c5a0e8

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js +0.1% 0.0% 847.86 KB 848.29 KB 193.2 KB 193.29 KB UMD_DEV
react-dom.production.min.js -0.0% -0.0% 105.12 KB 105.07 KB 34.14 KB 34.14 KB UMD_PROD
react-dom.profiling.min.js -0.0% +0.1% 108.27 KB 108.25 KB 35.16 KB 35.18 KB UMD_PROFILING
react-dom.development.js +0.1% 0.0% 842.18 KB 842.61 KB 191.64 KB 191.73 KB NODE_DEV
react-dom.production.min.js -0.0% 🔺+0.1% 105.11 KB 105.07 KB 33.55 KB 33.58 KB NODE_PROD
react-dom.profiling.min.js -0.0% 0.0% 108.46 KB 108.43 KB 34.44 KB 34.45 KB NODE_PROFILING
ReactDOM-dev.js +0.1% +0.1% 867.61 KB 868.13 KB 193.22 KB 193.34 KB FB_WWW_DEV
ReactDOM-prod.js 0.0% 0.0% 353.02 KB 353.02 KB 65.32 KB 65.32 KB FB_WWW_PROD
ReactDOM-profiling.js 0.0% -0.0% 358 KB 358.16 KB 66.31 KB 66.29 KB FB_WWW_PROFILING
react-dom-unstable-fire.development.js +0.1% 0.0% 848.21 KB 848.64 KB 193.35 KB 193.44 KB UMD_DEV
react-dom-unstable-fire.production.min.js -0.0% -0.0% 105.13 KB 105.09 KB 34.15 KB 34.15 KB UMD_PROD
react-dom-unstable-fire.profiling.min.js -0.0% +0.1% 108.29 KB 108.26 KB 35.16 KB 35.18 KB UMD_PROFILING
react-dom-unstable-fire.development.js +0.1% 0.0% 842.52 KB 842.96 KB 191.78 KB 191.87 KB NODE_DEV
react-dom-unstable-fire.production.min.js -0.0% 🔺+0.1% 105.13 KB 105.08 KB 33.56 KB 33.59 KB NODE_PROD
react-dom-unstable-fire.profiling.min.js -0.0% 0.0% 108.47 KB 108.44 KB 34.45 KB 34.46 KB NODE_PROFILING
ReactFire-dev.js +0.1% +0.1% 866.81 KB 867.34 KB 193.16 KB 193.28 KB FB_WWW_DEV
ReactFire-prod.js -0.0% 0.0% 340.99 KB 340.96 KB 62.92 KB 62.93 KB FB_WWW_PROD
ReactFire-profiling.js 0.0% -0.0% 345.95 KB 346.11 KB 63.88 KB 63.88 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.76 KB 60.76 KB 15.84 KB 15.84 KB UMD_DEV
react-dom-unstable-native-dependencies.development.js 0.0% -0.0% 60.43 KB 60.43 KB 15.72 KB 15.72 KB NODE_DEV
react-dom-server.browser.development.js 0.0% -0.0% 133.34 KB 133.34 KB 35.23 KB 35.23 KB NODE_DEV
react-dom-server.node.development.js 0.0% -0.0% 135.28 KB 135.28 KB 35.78 KB 35.78 KB NODE_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.81 KB 3.81 KB 1.53 KB 1.54 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.1% 1.21 KB 1.21 KB 704 B 705 B UMD_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.1% +0.1% 583.76 KB 584.2 KB 127.75 KB 127.86 KB UMD_DEV
react-art.production.min.js -0.1% -0.0% 96.81 KB 96.76 KB 29.8 KB 29.8 KB UMD_PROD
react-art.development.js +0.1% +0.1% 514.67 KB 515.1 KB 110.25 KB 110.37 KB NODE_DEV
react-art.production.min.js -0.1% 🔺+0.1% 61.79 KB 61.74 KB 19.04 KB 19.06 KB NODE_PROD
ReactART-dev.js +0.1% +0.1% 524.97 KB 525.5 KB 109.58 KB 109.7 KB FB_WWW_DEV
ReactART-prod.js -0.0% -0.1% 201.25 KB 201.21 KB 34.34 KB 34.29 KB FB_WWW_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-dev.js +0.1% +0.1% 657.25 KB 657.77 KB 139.97 KB 140.05 KB RN_FB_DEV
ReactNativeRenderer-prod.js -0.0% -0.0% 249.21 KB 249.18 KB 43.37 KB 43.36 KB RN_FB_PROD
ReactNativeRenderer-profiling.js +0.1% -0.0% 256.95 KB 257.11 KB 44.98 KB 44.97 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js +0.1% +0.1% 657.16 KB 657.68 KB 139.94 KB 140.02 KB RN_OSS_DEV
ReactNativeRenderer-prod.js -0.0% -0.0% 249.23 KB 249.19 KB 43.36 KB 43.36 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js +0.1% -0.0% 256.96 KB 257.12 KB 44.98 KB 44.97 KB RN_OSS_PROFILING
ReactFabric-dev.js +0.1% +0.1% 646 KB 646.52 KB 137.23 KB 137.33 KB RN_FB_DEV
ReactFabric-prod.js -0.0% -0.0% 242.41 KB 242.37 KB 42.04 KB 42.02 KB RN_FB_PROD
ReactFabric-profiling.js +0.1% -0.0% 250.16 KB 250.31 KB 43.69 KB 43.69 KB RN_FB_PROFILING
ReactFabric-dev.js +0.1% +0.1% 645.91 KB 646.43 KB 137.2 KB 137.3 KB RN_OSS_DEV
ReactFabric-prod.js -0.0% -0.0% 242.41 KB 242.38 KB 42.03 KB 42.02 KB RN_OSS_PROD
ReactFabric-profiling.js +0.1% -0.0% 250.17 KB 250.33 KB 43.69 KB 43.69 KB RN_OSS_PROFILING

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js +0.1% +0.1% 528.05 KB 528.48 KB 113.14 KB 113.22 KB UMD_DEV
react-test-renderer.production.min.js -0.1% -0.1% 63.08 KB 63.03 KB 19.47 KB 19.46 KB UMD_PROD
react-test-renderer.development.js +0.1% +0.1% 523.59 KB 524.02 KB 112.03 KB 112.11 KB NODE_DEV
react-test-renderer.production.min.js -0.1% 🔺+0.1% 62.76 KB 62.71 KB 19.23 KB 19.25 KB NODE_PROD
ReactTestRenderer-dev.js +0.1% +0.1% 535.96 KB 536.48 KB 112.08 KB 112.19 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 41.95 KB 41.95 KB 10.83 KB 10.83 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.74 KB 11.74 KB 3.67 KB 3.67 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.1% +0.1% 511.78 KB 512.21 KB 108.71 KB 108.79 KB NODE_DEV
react-reconciler.production.min.js -0.1% 🔺+0.1% 62.79 KB 62.74 KB 18.83 KB 18.85 KB NODE_PROD
react-reconciler-persistent.development.js +0.1% +0.1% 509.45 KB 509.89 KB 107.71 KB 107.78 KB NODE_DEV
react-reconciler-persistent.production.min.js -0.1% 🔺+0.1% 62.8 KB 62.75 KB 18.84 KB 18.86 KB NODE_PROD

Generated by 🚫 dangerJS

@bvaughn bvaughn force-pushed the devtools-commit-priority-level branch from a925a01 to c1e8e2d Compare May 16, 2019 21:16
@bvaughn
Copy link
Contributor Author

bvaughn commented May 16, 2019

🤔 Looks like importing ReactFiberScheduler from ReactFiberDevToolsHook causes ReactIncrementalErrorReplay-test.internal to fail with an invariant I don't understand yet:

Invariant Violation: This module must be shimmed by a specific renderer.

@bvaughn bvaughn changed the title [WIP] Profiler proof of concept (do not merge) Inform DevTools of commit priority level May 16, 2019
@bvaughn bvaughn requested review from gaearon and acdlite May 16, 2019 21:26
const currentTime = requestCurrentTime();
const priorityLevel = inferPriorityFromExpirationTime(
currentTime,
expirationTime,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these be DEV/PROFILE only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting. Yeah probably wouldn't hurt!

const priorityLevel = inferPriorityFromExpirationTime(
currentTime,
expirationTime,
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Andrew mentioned maybe we could use getCurrentPriorityLevel() here rather than inferring the priority level. I don't think the priority level a Fiber was scheduled with will necessarily match the current priority level though. (Maybe I misunderstood his suggestion.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you call getCurrentPriorityLevel inside commitRoot (not commitRootImpl, since that's always run at ImmediatePriority — it has to be the wrapper) then it will match the priority of the commit, which is not necessarily the same thing as the priority at which something was scheduled because multiple priorities can get batched.

This approach seems fine, though.

It's possible we may eventually track the priority on the update object.

@bvaughn bvaughn requested a review from gaearon May 19, 2019 15:18
Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

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

Seems legit

@@ -11,6 +11,10 @@

describe('ReactIncrementalErrorReplay-test', () => {
it('copies all keys when stashing potentially failing work', () => {
// Include a renderer to ensure host config files are properly shimmed.
// Otherwise transient imports may cause an invariant.
require('react-dom');
Copy link
Collaborator

Choose a reason for hiding this comment

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

I landed another PR which needed this fix so you should be able to revert this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, cool thanks.

@bvaughn bvaughn force-pushed the devtools-commit-priority-level branch from e65faef to dc7dcdb Compare May 20, 2019 15:21
@bvaughn bvaughn merged commit 50b50c2 into facebook:master May 20, 2019
@bvaughn bvaughn deleted the devtools-commit-priority-level branch May 20, 2019 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants