Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
object keys vs loop
(version: 0)
Comparing performance of:
fori vs forin vs foreach vs backwhile vs forcachelen vs 4of vs backfor
Created:
9 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var a = [{"id":7,"h":76},{"id":4,"h":34},{"id":9,"h":89}]; var d = [];
Tests:
fori
for(var i=0;i<a.length;i++)d.push(a[i].id);
forin
for(var i in a)d.push(i.id);
foreach
a.forEach((i)=>d.push(i.id));
backwhile
var i = a.length; while(--i)d.push(a[i].id);
forcachelen
var z = a.length; for(var i=0;i<z;i++)d.push(a[i].id);
4of
for(var i of a)d.push(i.id);
backfor
for(var i=a.length-1;i>=0;i--)d.push(a[i].id);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (7)
Previous results
Fork
Test case name
Result
fori
forin
foreach
backwhile
forcachelen
4of
backfor
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
object key vs indexof
object keys vs loop
Object.keys vs Object.values
key in object vs object.key
Object.keys vs Object.entries vs Object.values
Comments
Confirm delete:
Do you really want to delete benchmark?