Skip to content

Commit

Permalink
Add a simple initial-render benchmark test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiebits committed Oct 28, 2015
1 parent 65b9ceb commit e849819
Show file tree
Hide file tree
Showing 5 changed files with 15,885 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ docs/vendor/bundle/
examples/
# Ignore built files.
build/
scripts/bench/bench-*.js
vendor/react-dom.js
23 changes: 23 additions & 0 deletions scripts/bench/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Work-in-progress benchmarks.

## 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
```
Loading

0 comments on commit e849819

Please sign in to comment.