jquery is awesome

JavaScript performance comparison

Revision 4 of this test case created by Christian Stone

Preparation code

<div id="Stupid_Div">
  Stupid Crap
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
Benchmark.prototype.teardown = function() {
    $('#Stupid_div').html('');
};
</script>

Preparation code output

Stupid Crap

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
var mainDiv = $('#Stupid_Div');
var elements = [];
elements = [document.createElement('div').id = 'test1', document.createElement('div').id = 'test2', document.createElement('div').id = 'test3', document.createElement('div').id = 'test4']
$(mainDiv).html(elements);
pending…
Vanilla JS
var mainDiv = document.getElementById("Stupid_Div");
var elements = [];
elements = [document.createElement('div').id = 'test1', document.createElement('div').id = 'test2', document.createElement('div').id = 'test3', document.createElement('div').id = 'test4']
mainDiv.innerHTML=elements;
 
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