static-field-proto-vs-instance

Benchmark created on


Setup

function C1(x, y) {
	this.x = x;
	this.y = y;
}
C1.prototype.tag = 0;

function C2(x, y) {
	this.tag = 0;
	this.x = x;
	this.y = y;
}

Test runner

Ready to run.

Testing in
TestOps/sec
proto
const c1 = new C1(0, 1);
c1.tag;
ready
instance
const c2 = new C2(0, 1);
c2.tag;
ready

Revisions

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