React vs Jquery

JavaScript performance comparison

Revision 5 of this test case created by testKeys

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://fb.me/react-with-addons-0.8.0.min.js"></script>

<div id="test">

</div>
<script>
Benchmark.prototype.setup = function() {
    var Hello = React.createClass({
        render: function() {
            return React.DOM.div({}, this.props.greet);
        }
    });
   
    var element = $('<div data-reactid=".r[42sfx]">Hello World</div>')[0];
    //$("#test").append('<div data-reactid=".r[42sfx]">Hello World</div>')
    var tt = $("#test")[0];
};

Benchmark.prototype.teardown = function() {
    $("#test").empty();
   
   
};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
jquery
document.getElementById('test').appendChild(element.cloneNode(true));
pending…
react
React.renderComponent(Hello({greet: 'Hello World'}), document.getElementById('test'));
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment