mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
This disables symbol renaming in production builds. The original variable and function names are preserved. All other forms of compression applied by Closure (dead code elimination, inlining, etc) are unchanged — the final program is identical to what we were producing before, just in a more readable form. The motivation is to make it easier to debug React issues that only occur in production — the same reason we decided to start shipping sourcemaps in #28827 and #28827. However, because most apps run their own minification step on their npm dependencies, it's not necessary for us to minify the symbols before publishing — it'll be handled the app, if desired. This is the same strategy Meta has used to ship React for years. The React build itself has unminified symbols, but they get minified as part of Meta's regular build pipeline. Even if an app does not minify their npm dependencies, gzip covers most of the cost of symbol renaming anyway. This saves us from having to ship sourcemaps, which means even apps that don't have sourcemaps configured will be able to debug the React build as easily as they would any other npm dependency. |
||
|---|---|---|
| .. | ||
| benchmarks | ||
| .gitignore | ||
| benchmark.js | ||
| build.js | ||
| package.json | ||
| README.md | ||
| runner.js | ||
| server.js | ||
| stats.js | ||
| yarn.lock | ||
React Benchmarking
Commands
In most cases, the only two commands you might want to use are:
yarn startyarn --cwd=../../ build react/index,react-dom/index --type=UMD_PROD && yarn start --skip-build
The first command will run benchmarks with all the default settings. A local and remote build will occur on React and ReactDOM UMD bundles, both local and remote repos will be run against all benchmarks.
The second command will run all benchmarks but skip the build process. This is useful for when doing local performance tweaking and the remote repo has already had its bundles built. Both local and remote repos will be run against all benchmarks with this command too.
The other commands are as follows:
# will compare local repo vs remote merge base repo
yarn start
# will compare local repo vs remote merge base repo
# this can significantly improve bench times due to no build
yarn start --skip-build
# will only build and run local repo against benchmarks (no remote values will be shown)
yarn start --local
# will only build and run remote merge base repo against benchmarks (no local values will be shown)
yarn start --remote
# will only build and run remote main repo against benchmarks
yarn start --remote=main
# same as "yarn start"
yarn start --remote --local
# runs benchmarks with Chrome in headless mode
yarn start --headless
# runs only specific string matching benchmarks
yarn start --benchmark=hacker