Test name | Executions per second |
---|---|
use basic for | 102308.3 Ops/sec |
use basic for (start at last) | 102653.6 Ops/sec |
use while (start at last) | 43610.0 Ops/sec |
use forEach | 4082.8 Ops/sec |
use every | 5982.5 Ops/sec |
use for...in | 193343.4 Ops/sec |
use for...of | 21995.6 Ops/sec |
const arr = new Array(10000);
for (var i = 0; i < arr.length; i++) {
var a = arr[i]
}
const arr = new Array(10000);
for (var i = arr.length; i >= 0; i--) {
var a = arr[i]
}
const arr = new Array(10000);
var i = arr.length
while (i--) {
var a = arr[i]
}
const arr = new Array(10000);
arr.forEach(v => {
var a = v
});
const arr = new Array(10000);
arr.every(v => {
var a = v
return true
});
const arr = new Array(10000);
for (var v in arr) {
var a = v
}
const arr = new Array(10000);
for(var v of arr) {
var a = v
}