Skip to content

Commit a65a485

Browse files
committed
Merge pull request #5309 from spicyj/bench
Add a simple initial-render benchmark test case
2 parents 2c176da + e849819 commit a65a485

5 files changed

Lines changed: 15885 additions & 0 deletions

File tree

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ docs/vendor/bundle/
1111
examples/
1212
# Ignore built files.
1313
build/
14+
scripts/bench/bench-*.js
1415
vendor/react-dom.js

scripts/bench/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Work-in-progress benchmarks.
2+
3+
## Running one
4+
One thing you can do with them is benchmark initial render time for a realistic hierarchy:
5+
6+
```
7+
$ which jsc
8+
/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Resources/jsc
9+
$ 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);'
10+
45
11+
```
12+
13+
Substitute `js` or `v8` for `jsc` to use SpiderMonkey or V8, respectively, if you've installed them.
14+
15+
## Creating one
16+
17+
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`.
18+
19+
Then to convert it to ES5:
20+
21+
```
22+
babel --whitelist react,react.displayName --compact false bench-pe.js >bench-pe-es5.js
23+
```

0 commit comments

Comments
 (0)