destruct vs positional

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
destruct
class Pair {
  x;
  y;
  constructor({x, y}) {
    this.x = x;
    this.y = y;
  }
}
const pair = new Pair({y: 2, x: 1});
ready
positional
class Pair {
  x;
  y;
  constructor(x, y) {
    this.x = x;
    this.y = y;
  }
}
const pair = new Pair(1, 2);
ready
builder
class Pair {
  x;
  y;
  $x(x) {
  	this.x = x;
  	return this;
  }
  $y(y) {
  	this.y = y;
  	return this;
  }
}
const pair = new Pair().$y(2).$x(1);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.