JIT is weird

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
fill and map
new Array(100).fill(0).map((_, i) => { return i*2; });
ready
For loop
const arr = [];
for (var i = 0; i < 100; i++) {
  arr.push(i*2);
}
ready
grug while loop
var arr = [];
while (true) {
  arr.push(arr.length * 2);
  if (arr.length == 100) break;
}
ready
bodyless for loop
for(
 var arr = new Array(100), i = arr.length;
 i--;
 arr[i] = i*2
);
ready
bodyless for loop Uint8Array
for(
 var arr = new Uint8Array(100), i = arr.length;
 i--;
 arr[i] = i*2
);
ready

Revisions

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