Spread

Benchmark created on


Setup

const arr = [1, 2, 3, 4]


function makeObjArray(args) {
	return {a: args[0], b: args[1], c: args[2], d: args[3]};
}

function makeObjParams(v0, v1, v2, v3) {
	return {a: v0, b: v1, c: v2, d: v3};
}

Test runner

Ready to run.

Testing in
TestOps/sec
PassArray
makeObjArray(arr)
ready
PassSpread
makeObjParams(...arr)
ready
PassParams
makeObjParams(arr[0], arr[1], arr[2], arr[3])
ready

Revisions

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