jQuery vs createElement (v84)

Revision 84 of this benchmark created by mmm on


Description

Benchmarks from answer on StackOverflow: http://stackoverflow.com/questions/268490/jquery-document-createelement-equivalent/268520

Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
$()
var idWrap = $('<div id="id"><div id="a"><div id="b"><div id="c"><div id="d"><div id="e"></div></div></div></div></div>');

$(idWrap).find('#a').width(100).find('#b').width(100).find('#c').width(100).find('#d').width(100).find('#e').width(100);

$(idWrap).appendTo('body');
ready
document.createElement
var id=document.createElement('div');
id.id='id';

var a=document.createElement('div');
a.id='a';

var b=document.createElement('div');
b.id='b';

var c=document.createElement('div');
c.id='c';

var d=document.createElement('div');
d.id='d';

var e=document.createElement('div');
e.id='e';

$(id).append($(a)).find('#a').append($(b)).width(100).find('#b').append($(c)).width(100).find('#c').append($(d)).width(100).find('#d').append($(e)).width(100).find('#e').width(100);

$(id).appendTo('body');
ready

Revisions

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