object create prototype

JavaScript performance comparison

Revision 2 of this test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var x = 3
    var y = 4
    var args = [x, y]
   
    var Create = function(x, y) {
      this.x = x
      this.y = y
    };
    Create.prototype = {
      x: 1,
      y: 2
    };
};
</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
literal
var a = {
  type: Create.prototype
};
pending…
constructor
var d = new Create(x, y);
pending…
create & apply
var c = Object.create(Create.prototype);
Create.apply(c, args)
pending…
create & call
var c = Object.create(Create.prototype);
Create.call(c, x, y)
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