document.getElementById VS Jquery $('#') (v29)

Revision 29 of this benchmark created by kirillmurashov on


Description

Comparison for $('#idSelector') VS document.getElementById('');

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<p id="foo">
  Test
</p>

Test runner

Ready to run.

Testing in
TestOps/sec
test1
document.getElementById('foo');
ready
Test2
$('#foo');
ready
Test3
$(document.getElementById('foo'));
ready
Test4
document.querySelector('#foo')
ready

Revisions

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