for loop

Benchmark created on


Description

for loop

Test runner

Ready to run.

Testing in
TestOps/sec
if fisrt
const arr = [{type: 'a'},{type: 'b'},{type: 'c'}]
const typeA = []
const typeB = []
const typeC = []
for(obj in arr){ 
if(obj.type ==='a') typeA.push(obj)
if(obj.type ==='b') typeB.push(obj)
if(obj.type ==='c') typeC.push(obj)
}
typeA.map(x=>x)
typeB.map(x=>x)
typeC.map(x=>x)
ready
for first
const arr = [{type: 'a'},{type: 'b'},{type: 'c'}]
const typeA = []
const typeB = []
const typeC = []
for(obj in arr){ 
if(obj.type ==='a') return obj
if(obj.type ==='b') return obj
if(obj.type ==='c') return obj
}
ready

Revisions

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