inherited_vs_assigned (v2)

Revision 2 of this benchmark created by jocage on


Setup

var prototyped = function(height) {
      this.height = height;
    };
    prototyped.prototype.getHeight = function() {
      return this.height;
    }
    
    var assigned = function(height) {
      this.height = height;
      this.getHeight = function() {
        return this.height;
      }
    }
    
    var Assa = new Function(height) {
      this.height = height;
      this.getHeight = function() {
        return this.height;
      }
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Inherited
var t = new prototyped(10);
t.getHeight();
ready
assigned
var a = new assigned(10);
a.getHeight();
ready
with A
var a = new Assa(10);
a.getHeight();
ready

Revisions

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