Created
June 10, 2016 01:14
-
-
Save cameronbourke/284de4dcd762c83dd5cb538403cc7be1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import Perf from 'react-addons-perf'; | |
import { range } from 'ramda'; | |
window.Perf = Perf; | |
Perf.start(); | |
class Foo extends React.Component { | |
constructor () { | |
super(); | |
// this.handleClick = this.handleClick.bind(this) | |
} | |
handleClick () { | |
// | |
} | |
render () { | |
return ( | |
<div onClick={this.handleClick.bind(this)}> | |
{"Foo"} | |
{this.props.children || null} | |
</div> | |
); | |
} | |
} | |
class Bar extends React.Component { | |
constructor () { | |
super(); | |
// this.handleClick = this.handleClick.bind(this) | |
} | |
handleClick () { | |
// | |
} | |
render () { | |
return ( | |
<div onClick={this.handleClick.bind(this)}> | |
{"Bar"} | |
{this.props.children || null} | |
</div> | |
); | |
} | |
} | |
const App = () => ( | |
<div> | |
{range(0, 50).map((num, i) => { | |
return ( | |
<Foo> | |
{range(0, 20).map((num, i) => { | |
return ( | |
<Bar> | |
<Foo /> | |
</Bar> | |
) | |
})} | |
</Foo> | |
); | |
})} | |
</div> | |
); | |
const render = () => { | |
ReactDOM.render( | |
<App />, | |
document.getElementById('root') | |
); | |
}; | |
render(); | |
for (let i = 0; i < 50; i++) { | |
render(); | |
} | |
Perf.stop(); | |
const measurements = Perf.getLastMeasurements(); | |
Perf.printInclusive(measurements); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment