react-ssr-benchmarks
The purpose of this repo is to host runnable benchmarks of React's server-side rendering across different versions.
I've browserified React into different bundles which exist in the react/ folder.
The benchmarks are ran with NODE_ENV=production
so that checks and warnings are skipped.
Instructions
- Clone this repo.
- Run
npm install
. - Run
npm run bench
.
API
If you wish to run your own benchmarks (say you're developing your own renderToString function) you can do so programatically:
const benchmarks =
The benchmarks
function is configurable. The following config will only run the benchmarks on React versions 14 and 15.
const benchmarks =
You don't have to set 12 and 13 to false
explicitly, they can be omitted and won't be ran.
const benchmarks =
If you wish to change the component or how it is rendered in the benchmark, we've got options for you:
const benchmarks =
Finally, to add your own suite of tests to run against React you can pass in a test
Array:
const benchmarks =
Results
Simple
12 x 41,539 ops/sec ±1.95% (86 runs sampled)13 x 49,345 ops/sec ±3.08% (82 runs sampled)14 x 65,459 ops/sec ±2.99% (83 runs sampled)15 x 103,724 ops/sec ±2.55% (82 runs sampled)
Complex
12 x 44.76 ops/sec ±1.76% (57 runs sampled)13 x 49.06 ops/sec ±3.41% (63 runs sampled)14 x 70.77 ops/sec ±2.07% (61 runs sampled)15 x 65.38 ops/sec ±4.63% (63 runs sampled)
License
MIT