Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JS multiple parameters vs parameter object two functions
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Multiple parameters
3902959.0 Ops/sec
Existing parameter object
6951874.0 Ops/sec
Parameter object with spreading
7182855.5 Ops/sec
New parameter object
11536934.0 Ops/sec
Script Preparation code:
var data = { a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7 } function f1(a, b, c, d, e, f, g) { return a + b + c + d + e + f + g; } function f2({ a, b, c, d, e, f, g }) { return a + b + c + d + e + f + g; }
Tests:
Multiple parameters
f1(data.a, data.b, data.c, data.d, data.e, data.f, Math.random())
Existing parameter object
data.g = Math.random(); f2(data)
Parameter object with spreading
f2({ ...data, g: Math.random() })
New parameter object
f2({ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: Math.random() })