object spread (v3)

Revision 3 of this benchmark created on


Setup

const obj = {"a": 1, "b": 2, "c": 3}

Test runner

Ready to run.

Testing in
TestOps/sec
spread
const clone = {...obj, c: "3", d: 4}
ready
for
const clone = {}

const names = ["a", "b", "c"]


for (let i = 0; i < names.length; i++) {
	switch (names[i]) {
		case "c":
			clone[names[i]] = "3";
			break;
		default:
			clone[names[i]] = obj[names[i]]
		
	}
}

clone["d"] = 4
ready

Revisions

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