Object assign vs spread

Benchmark created on


Setup

const a = {
	p1: 'sgffdg',
	p2: true,
	p3: {
		p4: 'test'
	},
	p5: 5,
};
const b = {
	p5: 8,
	p6: false
};

Test runner

Ready to run.

Testing in
TestOps/sec
Assign
const objAssign = Object.assign(a, b);
ready
Spread
const objSpread = {...a, ...b};
ready

Revisions

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