Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
ES6 Class vs Prototype vs Object Literal 4
Test the speed and memory usage using 3 different techniques for constructing class objects.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPad; CPU OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.4.2 Mobile/15E148 Safari/604.1 Brave
Browser:
Mobile Safari 26
Operating system:
iOS 18.7
Device Platform:
Tablet
Date tested:
2 months ago
Object Literal
98.2M/s
Function Prototype
5.0M/s
ES6 Class
4.2M/s
View exact numbers
Test name
Executions per second
✓
Object Literal
98,213,504 Ops/sec
Function Prototype
4,976,983 Ops/sec
ES6 Class
4,177,442 Ops/sec
Tests:
ES6 Class
class Point { constructor(x, y){ this.x = x; this.y = y; } } var p1 = new Point(10, 10); var p2 = new Point(10, -10);
Function Prototype
function Point(x, y){ this.x = x; this.y = y; } var p1 = new Point(10, 10); var p2 = new Point(10, -10);
Object Literal
function Point(x, y){ return { x, y } } var p1 = Point(10, 10); var p2 = Point(10, -10);