object spread (v2)

Revision 2 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++) {
	if (names[i] === "c") {
		clone[names[i]] = "3"
	} else {
	    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.