Skip to content

Conversation

@acdlite
Copy link
Collaborator

@acdlite acdlite commented Feb 23, 2019

Some of our older tests worked by counting how many times React checked whether it should yield to the main thread, instead of something publicly observable like how many times a component is rendered.

Our newer tests have converged on a style where we push into a log and make assertions on the log. This pattern is less coupled to the implementation while still being sufficient to test performance optimizations, like resuming (whenever we add that back).

This PR removes flushDeferredPri and flushUnitsOfWork and upgrades the affected tests.

Follow-ups

  • Unify noop and test renderer APIs
    • Replace the generator implementation by having ReactNoop.yield push into a global array.
    • Use custom jest matchers to flush and assert on yielded values.
    • Warn if a test attempts to flush work while the log is non-empty.

Some of our older tests worked by counting how many times React checked
whether it should yield to the main thread, instead of something
publicly observable like how many times a component is rendered.

Our newer tests have converged on a style where we push into a log and
make assertions on the log. This pattern is less coupled to the
implementation while still being sufficient to test performance
optimizations, like resuming (whenever we add that back).

This commit removes flushDeferredPri and flushUnitsOfWork and upgrades
the affected tests.
This wrapper is no longer necessary.
@acdlite acdlite force-pushed the remove-flushdeferredpri branch from 8228a0b to eb43106 Compare February 23, 2019 01:17
@sizebot
Copy link

sizebot commented Feb 23, 2019

ReactDOM: size: -0.1%, gzip: -0.1%

Details of bundled changes.

Comparing: 920b0bb...eb43106

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js -0.1% -0.1% 767.87 KB 767.44 KB 175.17 KB 175.04 KB UMD_DEV
react-dom.production.min.js -0.1% -0.1% 105.37 KB 105.31 KB 33.94 KB 33.91 KB UMD_PROD
react-dom.profiling.min.js -0.1% -0.1% 108.29 KB 108.22 KB 34.82 KB 34.8 KB UMD_PROFILING
react-dom.development.js -0.1% -0.1% 762.48 KB 762.08 KB 173.69 KB 173.53 KB NODE_DEV
react-dom.production.min.js -0.0% -0.1% 105.53 KB 105.52 KB 33.43 KB 33.41 KB NODE_PROD
react-dom.profiling.min.js -0.0% -0.1% 108.61 KB 108.6 KB 34.25 KB 34.22 KB NODE_PROFILING
ReactDOM-dev.js -0.0% -0.1% 785.55 KB 785.17 KB 174.88 KB 174.76 KB FB_WWW_DEV
ReactDOM-prod.js -0.0% -0.1% 322.39 KB 322.24 KB 58.76 KB 58.72 KB FB_WWW_PROD
ReactDOM-profiling.js -0.0% -0.1% 328.97 KB 328.82 KB 60.24 KB 60.2 KB FB_WWW_PROFILING
react-dom-unstable-fire.development.js -0.1% -0.1% 768.22 KB 767.79 KB 175.32 KB 175.17 KB UMD_DEV
react-dom-unstable-fire.production.min.js -0.1% -0.1% 105.38 KB 105.32 KB 33.94 KB 33.92 KB UMD_PROD
react-dom-unstable-fire.profiling.min.js -0.1% -0.1% 108.3 KB 108.24 KB 34.83 KB 34.8 KB UMD_PROFILING
react-dom-unstable-fire.development.js -0.1% -0.1% 762.82 KB 762.42 KB 173.83 KB 173.67 KB NODE_DEV
react-dom-unstable-fire.production.min.js -0.0% -0.1% 105.55 KB 105.54 KB 33.44 KB 33.42 KB NODE_PROD
react-dom-unstable-fire.profiling.min.js -0.0% -0.1% 108.62 KB 108.61 KB 34.26 KB 34.23 KB NODE_PROFILING
ReactFire-dev.js -0.0% -0.1% 784.76 KB 784.38 KB 174.83 KB 174.71 KB FB_WWW_DEV
ReactFire-prod.js -0.0% -0.1% 310.82 KB 310.67 KB 56.43 KB 56.39 KB FB_WWW_PROD
ReactFire-profiling.js -0.0% -0.1% 317.43 KB 317.28 KB 57.85 KB 57.8 KB FB_WWW_PROFILING
react-dom-test-utils.production.min.js 0.0% 0.0% 10.27 KB 10.27 KB 3.8 KB 3.8 KB UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 46.78 KB 46.78 KB 12.92 KB 12.92 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 10.05 KB 10.05 KB 3.73 KB 3.73 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.61 KB 60.61 KB 15.92 KB 15.92 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 11.01 KB 11.01 KB 3.81 KB 3.81 KB UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.28 KB 60.28 KB 15.79 KB 15.79 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10.75 KB 10.75 KB 3.71 KB 3.71 KB NODE_PROD
react-dom-server.browser.development.js 0.0% 0.0% 127.21 KB 127.21 KB 33.88 KB 33.88 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 18.89 KB 18.89 KB 7.22 KB 7.22 KB UMD_PROD
react-dom-server.browser.development.js 0.0% 0.0% 123.35 KB 123.35 KB 32.95 KB 32.95 KB NODE_DEV
ReactDOMServer-dev.js 0.0% 0.0% 124.29 KB 124.29 KB 32.45 KB 32.46 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% -0.0% 45.27 KB 45.27 KB 10.43 KB 10.43 KB FB_WWW_PROD
react-dom-server.node.development.js 0.0% 0.0% 125.4 KB 125.4 KB 33.49 KB 33.49 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 19.69 KB 19.69 KB 7.52 KB 7.52 KB NODE_PROD
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.63 KB 3.63 KB 1.44 KB 1.44 KB UMD_DEV
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.45 KB 3.45 KB 1.39 KB 1.39 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-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.7 KB 3.7 KB 1.42 KB 1.42 KB NODE_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.2% 1.1 KB 1.1 KB 666 B 667 B NODE_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% 543.95 KB 543.52 KB 118.4 KB 118.26 KB UMD_DEV
react-art.production.min.js -0.1% -0.1% 97.37 KB 97.31 KB 29.88 KB 29.85 KB UMD_PROD
react-art.development.js -0.1% -0.1% 475 KB 474.6 KB 101.17 KB 101.03 KB NODE_DEV
react-art.production.min.js -0.0% -0.2% 62.41 KB 62.4 KB 19.04 KB 19.01 KB NODE_PROD
ReactART-dev.js -0.1% -0.1% 484.33 KB 483.96 KB 100.45 KB 100.3 KB FB_WWW_DEV
ReactART-prod.js -0.1% -0.2% 195.61 KB 195.46 KB 33.09 KB 33.04 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% 610.01 KB 609.56 KB 130.95 KB 130.82 KB RN_FB_DEV
ReactNativeRenderer-prod.js -0.1% -0.1% 246.98 KB 246.83 KB 43.12 KB 43.07 KB RN_FB_PROD
ReactNativeRenderer-profiling.js -0.1% -0.1% 253.33 KB 253.18 KB 44.67 KB 44.62 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js -0.1% -0.1% 609.92 KB 609.47 KB 130.92 KB 130.78 KB RN_OSS_DEV
ReactNativeRenderer-prod.js -0.1% -0.1% 246.99 KB 246.84 KB 43.11 KB 43.06 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js -0.1% -0.1% 253.34 KB 253.19 KB 44.66 KB 44.61 KB RN_OSS_PROFILING
ReactFabric-dev.js -0.1% -0.1% 600.86 KB 600.41 KB 128.68 KB 128.54 KB RN_FB_DEV
ReactFabric-prod.js -0.1% -0.1% 239.32 KB 239.17 KB 41.63 KB 41.59 KB RN_FB_PROD
ReactFabric-profiling.js -0.1% -0.1% 245.55 KB 245.4 KB 43.17 KB 43.12 KB RN_FB_PROFILING
ReactFabric-dev.js -0.1% -0.1% 600.77 KB 600.32 KB 128.64 KB 128.5 KB RN_OSS_DEV
ReactFabric-prod.js -0.1% -0.1% 239.33 KB 239.18 KB 41.63 KB 41.58 KB RN_OSS_PROD
ReactFabric-profiling.js -0.1% -0.1% 245.56 KB 245.41 KB 43.17 KB 43.12 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% 487.08 KB 486.63 KB 103.55 KB 103.42 KB UMD_DEV
react-test-renderer.production.min.js -0.1% -0.1% 63.77 KB 63.72 KB 19.53 KB 19.52 KB UMD_PROD
react-test-renderer.development.js -0.1% -0.1% 481.52 KB 481.07 KB 102.25 KB 102.1 KB NODE_DEV
react-test-renderer.production.min.js -0.1% -0.2% 63.44 KB 63.38 KB 19.21 KB 19.18 KB NODE_PROD
ReactTestRenderer-dev.js -0.1% -0.1% 491.59 KB 491.15 KB 101.86 KB 101.72 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% -0.0% 37.2 KB 37.2 KB 9.5 KB 9.5 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.12 KB 11.12 KB 3.35 KB 3.35 KB UMD_PROD
react-test-renderer-shallow.production.min.js 0.0% -0.0% 11.77 KB 11.77 KB 3.65 KB 3.65 KB NODE_PROD

react-noop-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-noop-renderer.development.js +1.5% +0.2% 32.33 KB 32.82 KB 7.44 KB 7.45 KB NODE_DEV
react-noop-renderer.production.min.js 🔺+0.1% -0.3% 11.24 KB 11.26 KB 3.69 KB 3.68 KB NODE_PROD
react-noop-renderer-persistent.development.js +1.5% +0.2% 32.44 KB 32.94 KB 7.45 KB 7.47 KB NODE_DEV
react-noop-renderer-persistent.production.min.js 🔺+0.1% -0.4% 11.26 KB 11.28 KB 3.7 KB 3.68 KB NODE_PROD
react-noop-renderer-server.development.js 0.0% +0.1% 1.83 KB 1.83 KB 876 B 877 B NODE_DEV
react-noop-renderer-server.production.min.js 0.0% 🔺+0.2% 813 B 813 B 490 B 491 B 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.2% 472.41 KB 471.95 KB 99.53 KB 99.38 KB NODE_DEV
react-reconciler.production.min.js -0.1% -0.2% 63.63 KB 63.56 KB 18.82 KB 18.79 KB NODE_PROD
react-reconciler-persistent.development.js -0.1% -0.2% 470.79 KB 470.33 KB 98.89 KB 98.74 KB NODE_DEV
react-reconciler-persistent.production.min.js -0.1% -0.2% 63.64 KB 63.57 KB 18.82 KB 18.79 KB NODE_PROD
react-reconciler-reflection.development.js 0.0% 0.0% 15.76 KB 15.76 KB 4.98 KB 4.98 KB NODE_DEV
react-reconciler-reflection.production.min.js 0.0% 🔺+0.1% 2.7 KB 2.7 KB 1.22 KB 1.23 KB NODE_PROD

Generated by 🚫 dangerJS

@acdlite acdlite merged commit ba708fa into facebook:master Feb 23, 2019
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.

4 participants