Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Classes vs functions
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0
Browser:
Firefox 125
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Class
95282.0 Ops/sec
Fn
20728696.0 Ops/sec
Tests:
Class
var Test = /** @class */ (function () { function Test(x) { this.x = x; } Test.prototype.add = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract1 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract2 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract3 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract4 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract5 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract16 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract26 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract36 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract46 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.add55 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract55 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract144 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract233 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract313 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract413 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract51 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract161 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract261 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract362 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract461 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.add4 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract41 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract14 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract24 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract34 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract44 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract54 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract164 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract264 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract364 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; Test.prototype.subtract446 = function () { var x = this.x; return new Test(Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); }; return Test; }()); for (var i = 0; i < 100; i++) { new Test(34235345345342342323423422334423).add(); }
Fn
function add(x) { return (Math.pow(x, 10) + Math.exp(x) + Math.sin(x) - Math.cos(x)); } for (var i = 0; i < 100; i++) { add(34235345345342342323423422334423); }