JQueryVsNative (v2)

Revision 2 of this benchmark created on


Description

There is a claim that jquery is much slower than native code. Let's check this!

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
native add div
 var body = document.getElementsByTagName('body')[0];
        var div = document.createElement('div');
        div.setAttribute('style', 'width: 100px; height: 100px; background-color: blue; ');
        body.appendChild(div);
 
ready
jquery add div
 $('body').append($('<div/>').css({width: 100, height:100, 'background-color':'blue'}));
 
ready
jquery add div 2
var dd='<div style="width:100px;height:100px;background-color:red"></div>'
$('body').append(dd);
 
ready
innerHTML
var dd='<div style="width:100px;height:100px;background-color:red"></div>'
document.getElementsByTagName('body').innerHTML= dd
ready

Revisions

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