query selector vs getelementbyid (v2)

Revision 2 of this benchmark created on


Preparation HTML

<html>
<body>
<div>
<div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div><div><iframe id="my-iframe"></iframe></div></div></div><div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div><div></div>
</div>
<body>
</html>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementById
const iframe = document.getElementById('my-iframe')
ready
query sleector
const iframe = document.querySelector('iframe[id="my-iframe"]')
ready

Revisions

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