Destroy Destroy Destroy

JavaScript performance comparison

Revision 4 of this test case created by Jonathan Perry

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var some = Object.keys({
       a: 1,
       b: 2,
       c: 3,
       d: 4,
       e: 5,
       f: function() {
        return 6;
       },
       g: [7, 8, 9]
      }),
      more = Array.prototype.slice.call(Object.keys({
       a: 1,
       b: 2,
       c: 3,
       d: 4,
       e: 5,
       f: function() {
        return 6;
       },
       g: [7, 8, 9]
      })),
      meat = Array.prototype.slice.call(Object.keys({
       a: 1,
       b: 2,
       c: 3,
       d: 4,
       e: 5,
       f: function() {
        return 6;
       },
       g: [7, 8, 9]
      })),
      pies = [ "a", "b", "c", "d", "e", "f", "g" ],
      s;
};
</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
Destroy Some
while (some.length > 0) { 
  s = some.shift();
}
pending…
Destroy More
while (more.length > 0) { 
  s = more.shift();
}
pending…
Destroy Meat
while (typeof (s = meat.shift()) === "string");
pending…
Destroy Pies
while (pies.length > 0) { 
  s = pies.shift();
}
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment