jQuery vs parseHTML vs createElement (v294)

Revision 294 of this benchmark created on


Description

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

Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
img = $(document.createElement('img'))
img = $(document.createElement('img'))
img.src = "http://lh4.ggpht.com/DBjgNISZEma0AoTF5ru7kbPSEKdGOYGETfzJ2J8tEZakv_mj_c1ZrE-42zcnmY5IDJ74jKgOGel_8uOonlpWuTjCIg=s300";
img.className = 'thumbnail';
ready
$('<img class="thumbnail" src="http://lh4.ggpht.com/DBjgNISZEma0AoTF5ru7kbPSEKdGOYGETfzJ2J8tEZakv_mj_c1ZrE-42zcnmY5IDJ74jKgOGel_8uOonlpWuTjCIg=s300"> ')
$('<img class="thumbnail" src="http://lh4.ggpht.com/DBjgNISZEma0AoTF5ru7kbPSEKdGOYGETfzJ2J8tEZakv_mj_c1ZrE-42zcnmY5IDJ74jKgOGel_8uOonlpWuTjCIg=s300"> ')
ready
$($.parseHTML('<div>'))
$($.parseHTML('<img class="thumbnail" src="http://lh4.ggpht.com/DBjgNISZEma0AoTF5ru7kbPSEKdGOYGETfzJ2J8tEZakv_mj_c1ZrE-42zcnmY5IDJ74jKgOGel_8uOonlpWuTjCIg=s300">'))
ready

Revisions

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