getDOMNode vs findDOMNode

Benchmark created by getDOMNode vs findDOMNode on


Preparation HTML

<html>
<head>
<script src="http://react.zpao.com/builds/master/latest/react.js"></script>
<script src="http://react.zpao.com/builds/master/latest/JSXTransformer.js"></script>
</head>
<body>

<div id="body"></div>

</body>
</html>

Setup

var jsx = [];
    
    for(var i=0;i<1000000;i++){
    jsx[0]='<div class=',i,'>'+i;
    jsx.push('</div>');
    }
    
    var react = JSXTransformer.transformReact(jsx);
    React.render(react,document.body);

Teardown


    jsx='';
  

Test runner

Ready to run.

Testing in
TestOps/sec
getDOMNode
console.log(this.getDOMNode());
 
ready
findDOMNode
console.log(React.findDOMNode(this));
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by getDOMNode vs findDOMNode on