Object creation (v2)

Revision 2 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
With one nested object
const userSample = { name: 'Jane' };
const addressSample = { street: 'Main St.', number: 213 };

function getUserInfo(user, address) {
	return userInfoAndAddress = {
      ...user,
      ...{
        street: address.street,
        number: address.number,
      },
    };
  }
}

const output = getUserInfo(userSample, addressSample);
ready
Without nested object
const user = { name: 'Jane' };
const address = { street: 'Main St.', number: 213 };

for (let i = 0; i < 10; i++) {
	
const userInfoAndAddress = {
  ...user,
  street: address.street,
  number: address.number,
};

}
ready

Revisions

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