jquery vs createElement with class (v17)

Revision 17 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
jquery (HTML)
var test = $('<span class="testClass">');
ready
create 1
var test = $(document.createElement('span'));
test.className = "testClass";
ready
create 2
var test = $(document.createElement('span')).addClass("testClass");
ready
create 3
var test = document.createElement('span');
test.className = "testClass";
ready
create 4
var test = document.createElement('span');
$(test).addClass("testClass");
ready
create 5
var test = $(document.createElement('span'));
test.addClass("testClass");
ready

Revisions

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