Creation of class vs POJO

Benchmark created on


Setup

const SIZE = 1000;
const classes = new Array(SIZE);
const pojos = new Array(SIZE);

class Klass {
	test() {
		return;
	}
}

function createPojo() {
	return {
		test() {
			return;
		}
	}
}

Test runner

Ready to run.

Testing in
TestOps/sec
Class
for (let i = 0; i < 1000; i++) {
	classes[i] = new Klass()
}
ready
POJO
for (let i = 0; i < 1000; i++) {
	pojos[i] = createPojo()
}
ready

Revisions

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