CoffeeScript vs augment
JavaScript performance comparison
Test case created by Aadit M Shah
Info
augment beats CoffeeScript hands down when it comes to inheritance, but how does it fare when it comes to one-on-one classes without inheritance?
Preparation code
<script src="https://raw.github.com/javascript/augment/master/augment.js"></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 |
CoffeeScript |
var Rectangle;
Rectangle = (function() {
function Rectangle(width, height) { this.width = width; this.height = height; }
Rectangle.prototype.area = function() { return this.width * this.height; };
return Rectangle;
})();
var rectangle = new Rectangle(3, 7); rectangle.area();
|
pending… |
augment |
var Rectangle = Object.augment(function () { this.area = function () { return this.width * this.height; };
return Rectangle;
function Rectangle(width, height) { this.height = height; this.width = width; } });
var rectangle = new Rectangle(3, 7); rectangle.area();
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
Compare results of other browsers
0 comments