Tests:
  • classes

    x
     
    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);
        }
    }
    const points = [];
    for(var i = 0; i < 1000; ++i) {
      points.push(new Point(i,i));
    }
  • literals

     
    function Point(x, y){
        return {
            x, 
            y, 
            add: (point)=>Point(this.x + point.x, this.y + point.y),
            sub: (point)=>Point(this.x - point.x, this.y - point.y)
        }  
    }
    const points = [];
    for(var i = 0; i < 1000; ++i) {
      points.push(Point(i,i));
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    classes
    literals

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Mobile Safari/537.36
Chrome Mobile 117 on Android
View result in a separate tab
Test name Executions per second
classes 4768.9 Ops/sec
literals 4336.5 Ops/sec