BenchOldSchool vs BenchNewSchool vs BenchNewCurriedSchool

Edit on GitHub

Setup

Tests

  • BenchOldSchool

    var BenchOldSchool = (function () {
        function BenchOldSchool() {
        }
        BenchOldSchool.prototype.demo = function (val1, val2) {
            return val1 + val2;
        };
        return BenchOldSchool;
    }());
    var a = new BenchOldSchool();
    a.demo(1, 2);
  • BenchNewSchool

    var BenchNewSchool = (function () {
        function BenchNewSchool() {
            this.demo = function (val1, val2) {
                return val1 + val2;
            };
        }
        return BenchNewSchool;
    }());
    var b = new BenchNewSchool();
    b.demo(1, 2);
  • BenchNewCurriedSchool

    var BenchNewCurriedSchool = (function () {
        function BenchNewCurriedSchool() {
            this.demo = function (val1) { return function (val2) {
                return val1 + val2;
            }; };
        }
        return BenchNewCurriedSchool;
    }());
    var c = new BenchNewCurriedSchool();
    c.demo(1)(2);