react/scripts/bench
Ben Alpert c0007d56e9 Interleave trials in benchmark script
This should be more of a fair A/B test so the timings aren't affected by having different load on your system when testing the two alternatives.
2016-05-14 12:04:25 -07:00
..
README.md Interleave trials in benchmark script 2016-05-14 12:04:25 -07:00
analyze.py Year-agnostic copyright message, like React Native uses, to prevent the need for yearly changes. 2015-12-29 20:20:32 +01:00
bench-createclass.js Add createClass stress test 2015-11-25 18:24:46 -08:00
bench-pe-es5.js Add a simple initial-render benchmark test case 2015-10-28 13:14:24 -07:00
bench-pe.js Add a simple initial-render benchmark test case 2015-10-28 13:14:24 -07:00
extract-component.js Add a simple initial-render benchmark test case 2015-10-28 13:14:24 -07:00
measure.py Interleave trials in benchmark script 2016-05-14 12:04:25 -07:00

README.md

Work-in-progress benchmarks.

Running the suite

$ ./measure.py react-a.min.js a.txt react-b.min.js b.txt
$ ./analyze.py a.txt b.txt

Running one

One thing you can do with them is benchmark initial render time for a realistic hierarchy:

$ which jsc
/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Resources/jsc
$ jsc react-0.14.0.min.js bench-pe-es5.js -e 'var START=Date.now(); React.renderToString(React.createElement(Benchmark)); var END=Date.now(); print(END-START);'
45

Substitute js or v8 for jsc to use SpiderMonkey or V8, respectively, if you've installed them.

Creating one

To create one, copy extract-component.js to your clipboard and paste it into the Chrome console on facebook.com, perhaps after changing the root ID if you don't want the tree with ID .0.

Then to convert it to ES5:

babel --whitelist react,react.displayName --compact false bench-pe.js >bench-pe-es5.js