react/scripts/bench
Andrew Clark 857ee8cdf9
Don't minify symbols in production builds (#28881)
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.
2024-04-20 11:23:46 -04:00
..
benchmarks Don't minify symbols in production builds (#28881) 2024-04-20 11:23:46 -04:00
.gitignore update the benchmark script (#13994) 2018-11-05 15:55:46 +00:00
benchmark.js update the benchmark script (#13994) 2018-11-05 15:55:46 +00:00
build.js Refactor: Reuse variable "remoteRepoDir" (#25740) 2023-01-09 22:59:38 -05:00
package.json Bump minimist from 1.2.0 to 1.2.3 in /scripts/bench (#18500) 2020-04-06 19:29:11 +01:00
README.md Updated scripts and config to replace "master" with "main" branch (#21768) 2021-06-29 14:26:24 -04:00
runner.js Updated scripts and config to replace "master" with "main" branch (#21768) 2021-06-29 14:26:24 -04:00
server.js Fix a few typos (#10860) 2017-09-27 11:13:21 +01:00
stats.js Update prettier (#13205) 2018-07-17 20:18:34 +01:00
yarn.lock Bump ecstatic from 2.2.1 to 2.2.2 in /scripts/bench (#20468) 2021-06-29 16:53:31 -04:00

React Benchmarking

Commands

In most cases, the only two commands you might want to use are:

  • yarn start
  • yarn --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