Object creation performance

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Dynamic
const create = () => {
	let object = {};
	
	object.a = "a";
	object.b = 2;
	object.c = function() {
		return `${this.a} - ${this.b}`
	};
	
	return object;
};

const result = Array(100000).fill().map(create);
ready
Static
const create = () => {
	return {
		a: "a",
		b: 2,
		c: function() {
			return `${this.a} - ${this.b}`
		}
	};
};

const result = Array(100000).fill().map(create);
ready

Revisions

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