keysforeachvsvarin

JavaScript performance comparison

Test case created by josh

Preparation code

<script>
  var fruits = {
   "apple": "fruit",
   "banana": "fruit",
   "grapes": "fruit",
   "strawberry": "fruit",
   "mango": "fruit",
   "peach": "fruit",
   "taco": "not a fruit",
   "tomato": "fruit",
   "cherry": "fruit",
   "blackberry": "fruit"
  }
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
keys-foreach
Object.keys(fruits).forEach(function(el) {});
pending…
varin
for (var fruit in fruits) {
 if (fruits.hasOwnProperty(fruit)) {

 }
}
pending…

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

Compare results of other browsers

0 comments

Add a comment