inherited_vs_assigned

Benchmark created 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;
    }
    }

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

Revisions

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