Node loop

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
single
const nodes = Array.from({ length: 1 }, () => Math.random());
const nodesLen = nodes.length;
let bla = '';

bla = nodes[0];
ready
always loop
const nodes = Array.from({ length: 1 }, () => Math.random());
const nodesLen = nodes.length;
let bla = '';

for(let i = 0; i < nodesLen; i++) {
  bla = nodes[i];
}
ready
condition
const nodes = Array.from({ length: 1 }, () => Math.random());
const nodesLen = nodes.length;
let bla = '';

if(nodesLen > 1) {
  for(let i = 0; i < nodesLen; i++) {
    bla = nodes[i];
  }
} else {
  bla = nodes[0];
}
ready

Revisions

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