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

Apply the Just Noticeable Difference to suspense timeouts #15367

Merged
merged 2 commits into from
Apr 11, 2019

Conversation

sebmarkbage
Copy link
Collaborator

Increase the suspended time based on how long we've already waited.

The theory is that a person can't tell the difference between small differences in time. Therefore, if we wait a bit longer than necessary that won't translate to a noticeable negative difference in the experience. However, waiting for longer might mean that we can avoid showing an intermediate loading state which is a positive difference. The longer we have already waited, the harder it is to tell small differences in time. Therefore, the longer we've already waited, the longer we can wait additionally. At some point we have to give up though. We pick a train model where the next boundary commits at a consistent schedule.

@sebmarkbage sebmarkbage changed the title Apply the Just Noticeable Difference boundary Apply the Just Noticeable Difference to suspense timeouts Apr 10, 2019
@sebmarkbage
Copy link
Collaborator Author

The problem with this PR is that since we currently estimate the event time of "hi pri" updates as 5 seconds back in time. We think that we've waited a long time so if the hi-pri update suspends we'll wait a long time. Ideally we'd estimate these times correctly, but another approach is that we cap the timeout at the expiration time like we used it.

@sizebot
Copy link

sizebot commented Apr 10, 2019

ReactDOM: size: 🔺+0.1%, gzip: 🔺+0.3%

Details of bundled changes.

Comparing: 3e2e930...f46559a

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js +0.2% +0.3% 895.36 KB 897.34 KB 202.46 KB 203.08 KB UMD_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.3% 105.32 KB 105.46 KB 34.07 KB 34.17 KB UMD_PROD
react-dom.profiling.min.js +0.1% +0.2% 108.33 KB 108.46 KB 34.7 KB 34.79 KB UMD_PROFILING
react-dom.development.js +0.2% +0.3% 889.99 KB 891.96 KB 200.9 KB 201.54 KB NODE_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.2% 105.31 KB 105.45 KB 33.55 KB 33.62 KB NODE_PROD
react-dom.profiling.min.js +0.1% +0.2% 108.43 KB 108.57 KB 34.12 KB 34.2 KB NODE_PROFILING
ReactDOM-dev.js +0.2% +0.4% 915.94 KB 918.17 KB 202.63 KB 203.34 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.2% 🔺+0.2% 339.13 KB 339.79 KB 62.41 KB 62.53 KB FB_WWW_PROD
ReactDOM-profiling.js +0.2% +0.2% 346.21 KB 346.9 KB 63.85 KB 64 KB FB_WWW_PROFILING
react-dom-unstable-fire.development.js +0.2% +0.3% 895.68 KB 897.66 KB 202.59 KB 203.22 KB UMD_DEV
react-dom-unstable-fire.production.min.js 🔺+0.1% 🔺+0.3% 105.34 KB 105.47 KB 34.08 KB 34.18 KB UMD_PROD
react-dom-unstable-fire.profiling.min.js +0.1% +0.2% 108.34 KB 108.48 KB 34.71 KB 34.8 KB UMD_PROFILING
react-dom-unstable-fire.development.js +0.2% +0.3% 890.31 KB 892.29 KB 201.03 KB 201.67 KB NODE_DEV
react-dom-unstable-fire.production.min.js 🔺+0.1% 🔺+0.2% 105.33 KB 105.46 KB 33.56 KB 33.63 KB NODE_PROD
react-dom-unstable-fire.profiling.min.js +0.1% +0.2% 108.45 KB 108.58 KB 34.13 KB 34.21 KB NODE_PROFILING
ReactFire-dev.js +0.2% +0.4% 915.13 KB 917.36 KB 202.69 KB 203.4 KB FB_WWW_DEV
ReactFire-prod.js 🔺+0.2% 🔺+0.2% 327.79 KB 328.46 KB 60.13 KB 60.24 KB FB_WWW_PROD
ReactFire-profiling.js +0.2% +0.2% 334.81 KB 335.51 KB 61.51 KB 61.66 KB FB_WWW_PROFILING
react-dom-unstable-new-scheduler.development.js +0.2% +0.3% 888.49 KB 890.47 KB 200.29 KB 200.93 KB NODE_DEV
react-dom-unstable-new-scheduler.production.min.js 🔺+0.1% 🔺+0.2% 103.49 KB 103.62 KB 33.04 KB 33.11 KB NODE_PROD
react-dom-unstable-new-scheduler.profiling.min.js +0.1% +0.2% 106.83 KB 106.96 KB 33.92 KB 33.99 KB NODE_PROFILING
ReactDOMNewScheduler-dev.js +0.2% +0.4% 915.97 KB 918.2 KB 202.63 KB 203.35 KB FB_WWW_DEV
ReactDOMNewScheduler-prod.js 🔺+0.2% 🔺+0.2% 333.91 KB 334.74 KB 62.08 KB 62.21 KB FB_WWW_PROD
ReactDOMNewScheduler-profiling.js +0.2% +0.2% 339.17 KB 340 KB 63.09 KB 63.22 KB FB_WWW_PROFILING
react-dom-test-utils.production.min.js 0.0% -0.0% 10.31 KB 10.31 KB 3.82 KB 3.82 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.76 KB 60.76 KB 15.85 KB 15.85 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.69 KB 10.69 KB 3.67 KB 3.67 KB UMD_PROD
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-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.42 KB 10.42 KB 3.56 KB 3.57 KB NODE_PROD
react-dom-server.browser.production.min.js 0.0% 0.0% 19.18 KB 19.18 KB 7.21 KB 7.21 KB UMD_PROD
ReactDOMServer-dev.js 0.0% 0.0% 135.53 KB 135.53 KB 34.76 KB 34.76 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% 0.0% 48.04 KB 48.04 KB 11 KB 11 KB FB_WWW_PROD
react-dom-server.node.production.min.js 0.0% 0.0% 19.96 KB 19.96 KB 7.51 KB 7.51 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.1% 1.21 KB 1.21 KB 705 B 706 B UMD_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.49 KB 3.49 KB 1.41 KB 1.41 KB NODE_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.2% 1.05 KB 1.05 KB 636 B 637 B NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.3% +0.5% 639.48 KB 641.45 KB 138.25 KB 138.88 KB UMD_DEV
react-art.production.min.js 🔺+0.1% 🔺+0.2% 97.02 KB 97.15 KB 29.67 KB 29.73 KB UMD_PROD
react-art.development.js +0.3% +0.5% 570.69 KB 572.66 KB 120.92 KB 121.57 KB NODE_DEV
react-art.production.min.js 🔺+0.2% 🔺+0.4% 62.05 KB 62.18 KB 18.93 KB 19 KB NODE_PROD
ReactART-dev.js +0.4% +0.6% 581.58 KB 583.81 KB 120.51 KB 121.22 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.3% 🔺+0.4% 198.36 KB 199.02 KB 33.6 KB 33.73 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.3% +0.5% 715.15 KB 717.38 KB 151.32 KB 152.03 KB RN_FB_DEV
ReactNativeRenderer-prod.js 🔺+0.3% 🔺+0.3% 248.16 KB 248.82 KB 42.93 KB 43.07 KB RN_FB_PROD
ReactNativeRenderer-profiling.js +0.3% +0.4% 254.72 KB 255.41 KB 44.31 KB 44.46 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js +0.3% +0.5% 715.06 KB 717.29 KB 151.29 KB 151.99 KB RN_OSS_DEV
ReactNativeRenderer-prod.js 🔺+0.3% 🔺+0.3% 248.17 KB 248.83 KB 42.93 KB 43.06 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js +0.3% +0.4% 254.74 KB 255.43 KB 44.31 KB 44.46 KB RN_OSS_PROFILING
ReactFabric-dev.js +0.3% +0.5% 703.85 KB 706.07 KB 148.6 KB 149.31 KB RN_FB_DEV
ReactFabric-prod.js 🔺+0.3% 🔺+0.3% 241.47 KB 242.13 KB 41.63 KB 41.76 KB RN_FB_PROD
ReactFabric-profiling.js +0.3% +0.3% 247.38 KB 248.08 KB 42.97 KB 43.11 KB RN_FB_PROFILING
ReactFabric-dev.js +0.3% +0.5% 703.75 KB 705.98 KB 148.57 KB 149.28 KB RN_OSS_DEV
ReactFabric-prod.js 🔺+0.3% 🔺+0.3% 241.48 KB 242.14 KB 41.62 KB 41.75 KB RN_OSS_PROD
ReactFabric-profiling.js +0.3% +0.3% 247.4 KB 248.09 KB 42.97 KB 43.11 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.3% +0.5% 585.22 KB 587.19 KB 124.13 KB 124.77 KB UMD_DEV
react-test-renderer.production.min.js 🔺+0.2% 🔺+0.4% 63.34 KB 63.47 KB 19.37 KB 19.45 KB UMD_PROD
react-test-renderer.development.js +0.3% +0.5% 580.84 KB 582.82 KB 122.98 KB 123.63 KB NODE_DEV
react-test-renderer.production.min.js 🔺+0.2% 🔺+0.4% 63.06 KB 63.19 KB 19.17 KB 19.24 KB NODE_PROD
ReactTestRenderer-dev.js +0.4% +0.6% 593.29 KB 595.51 KB 123.16 KB 123.87 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% 0.0% 41.98 KB 41.98 KB 10.75 KB 10.75 KB UMD_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 36.21 KB 36.21 KB 9.41 KB 9.41 KB NODE_DEV

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.3% +0.5% 573.87 KB 575.84 KB 120.5 KB 121.13 KB NODE_DEV
react-reconciler.production.min.js 🔺+0.2% 🔺+0.4% 63.07 KB 63.2 KB 18.73 KB 18.81 KB NODE_PROD
react-reconciler-persistent.development.js +0.3% +0.5% 571.67 KB 573.65 KB 119.56 KB 120.2 KB NODE_DEV
react-reconciler-persistent.production.min.js 🔺+0.2% 🔺+0.4% 63.08 KB 63.21 KB 18.74 KB 18.82 KB NODE_PROD

Generated by 🚫 dangerJS

// Computes the next Just Noticeable Difference (JND) boundary.
// The theory is that a person can't tell the difference between small differences in time.
// Therefore, if we wait a bit longer than necessary that won't translate to a noticeable
// difference in the experience. However, waiting for longer might mean that we can avoid
Copy link
Contributor

Choose a reason for hiding this comment

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

can -> can't?

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