Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
aefq4fghtdgf3d2w
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser:
Chrome 130
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
ES6 Class
419582.8 Ops/sec
fff
2152200.5 Ops/sec
Tests:
ES6 Class
class Point { constructor(x, y){ this.x = x; this.y = y; } add(point){ return new Point(this.x + point.x, this.y + point.y); } sub(point){ return new Point(this.x - point.x, this.y - point.y); } } var p1 = new Point(10, 10); var p2 = new Point(10, -10); var sum = p1.add(p2); var dif = p1.sub(p2);
fff
function create_point(x,y){ return [ x , y ] } function add_points(a,b){ return new Float32Array( [ a[0] + b[0] , a[1] + b[1] ] ) } function sub_points(a,b){ return new Float32Array( [ a[0] - b[0] , a[1] - b[1] ] ); } var p1 = create_point(10,10); var p2 = create_point(10,-10); var sum = add_points(p1,p2); var dif = sub_points(p1,p2);