object spread

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++) {
	clone[names[i]] = obj[names[i]]
}


clone["c"] = "3"

clone["d"] = 4
ready

Revisions

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