querySelectorAll vs getElementById (v44)

Revision 44 of this benchmark created by shwups on


Preparation HTML

<span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span><span>gix</span>
<p id="foo">bar</p>

Test runner

Ready to run.

Testing in
TestOps/sec
querySelectorAll
var result = document.querySelectorAll('#foo')[0];
ready
querySelector
var result = document.querySelector('#foo');
 
ready
getElementById
var result = document.getElementById('foo');
ready

Revisions

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