Object.keysVS_in

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var obj = window;
};
</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
Object.keys
var keys = Object.keys (obj), l = keys.length, i = 0, key, value;
for (; i < l; i++) {
  key = keys[i];
  value = obj[key];
}
pending…
InLoop
var key, value;
for (key in obj) {
  value = obj [key];
}
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