Object creation

Benchmark created on


Setup

function createObj(name, value) {
	return {
		name,
		value
	}
}

Test runner

Ready to run.

Testing in
TestOps/sec
new Object
{}
ready
class Instance
class Foo {}
new Foo()
ready
create instance with defaults
class Foo {
	constructor(name, value) {
		this.name = name
		this.value = name
	}
}
new Foo("Foobar", 12)
ready
create object via function
createObj("MyObject", 135)
ready
create object via new operator
new Object()
ready
create instance via Function
function MyClass() {}
new MyClass()
ready

Revisions

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