Get Element By ID Loop

Benchmark created by sachleen on


Preparation HTML

<div id="hpl">Test</div>

Test runner

Ready to run.

Testing in
TestOps/sec
Outside
var hpl = document.getElementById("hpl");
for (i = 0; i < 1000; i++) {
    hpl.style.height = 28 + "px";
}
ready
Inside
for (i = 0; i < 1000; i++) {
    document.getElementById("hpl").style.height = 28 + "px";
}
ready

Revisions

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

  • Revision 1: published by sachleen on