fetch in loop, fetch once

Benchmark created on


Preparation HTML

<div id="test"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
fetch once
const a = document.getElementById('test')

for(var i = 0; i < 10000; i++){
	a.innerText = `${i}`
}
ready
fetch in loop


for(var i = 0; i < 10000; i++){
	const a = document.getElementById('test')
	a.innerText = `${i}`
}
ready

Revisions

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