Script Preparation code:
x
 
class ClassPoint {
    constructor(x, y) {
        this.x = x;
        this.y = y;
    }
    add(point) {
        this.x = this.x + point.x
        this.y = this.y + point.y
    }
    sub(point) {
        this.x = this.x - point.x
        this.y = this.y - point.y
    }
}
function FunctionPoint(x, y){
    this.x = x;
    this.y = y;
}
FunctionPoint.prototype.add = function(point){
        this.x = this.x + point.x
        this.y = this.y + point.y
}
FunctionPoint.prototype.sub = function(point){
        this.x = this.x - point.x
        this.y = this.y - point.y
}
function ObjectPoint(x, y){
    return {
        x, 
        y, 
        add:(point) => {
          this.x = this.x + point.x
          this.y = this.y + point.y
        },
        sub:(point) => {
          this.x = this.x - point.x
          this.y = this.y - point.y
        },
    }  
}
class Base {
    constructor(x, y){
        this.x = x;
        this.y = y;
    }
}
class ClassPoint2 extends Base {
  
    add(point){
        this.x = this.x + point.x
        this.y = this.y + point.y
    }
    sub(point){
        this.x = this.x - point.x
        this.y = this.y - point.y
    }
}
Tests:
  • ES6 Class

     
    var p1 = new ClassPoint(10, 10);
    var p2 = new ClassPoint(10, -10);
    var sum = p1.add(p2);
    var dif = p1.sub(p2);
  • Function Prototype

     
    var p1 = new FunctionPoint(10, 10);
    var p2 = new FunctionPoint(10, -10);
    var sum = p1.add(p2);
    var dif = p1.sub(p2);
  • Object Literal

     
    var p1 = ObjectPoint(10, 10);
    var p2 = ObjectPoint(10, -10);
    var sum = p1.add(p2);
    var dif = p1.sub(p2);
  • Class extends

     
    var p1 = new ClassPoint2(10, 10);
    var p2 = new ClassPoint2(10, -10);
    var sum = p1.add(p2);
    var dif = p1.sub(p2);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    ES6 Class
    Function Prototype
    Object Literal
    Class extends

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 months ago)
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36
Chrome Mobile 130 on Android
View result in a separate tab
Test name Executions per second
ES6 Class 80367560.0 Ops/sec
Function Prototype 86437768.0 Ops/sec
Object Literal 9827788.0 Ops/sec
Class extends 55557320.0 Ops/sec