3x Object assign vs Object spread (v3)

Revision 3 of this benchmark created on


Setup

const orig = {
	params: {
		a: 1,
		b: 2,
		c: 3
	}
};

const mod_params_c = { c: 4 };

let tmpParams;
let modified;

Test runner

Ready to run.

Testing in
TestOps/sec
Object.assign
tmpParams = Object.assign({}, orig.params, mod_params_c);
modified = Object.assign({}, orig, { params: tmpParams });
ready
Spread operator
tmpParams = { ...orig.params, mod_params_c };
modified = { ...orig, params: tmpParams };
ready

Revisions

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