Head, Body, ID query

Benchmark created on


Preparation HTML

<div id="some-id">

</div>

Setup

const els = [document.body];
for (let i = 0; i < 2500; i++) {
	const div = document.createElement('div');
	els[Math.floor(Math.random()) * els.length].appendChild(div);
	els.push(div);
}

Test runner

Ready to run.

Testing in
TestOps/sec
querySelector
document.querySelector('head');
document.querySelector('body');
document.querySelector('#some-id');
ready
others
document.head;
document.body;
document.getElementById('some-id')
ready

Revisions

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