Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Merge objects with spread vs foreach & new
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Browser:
Chrome 115
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Spread object
20076260.0 Ops/sec
forEach & new
5960717.0 Ops/sec
Script Preparation code:
var a = {'a': 10, 'b': 20, 'c': 30}; var b = {'b': 21, 'c': 31};
Tests:
Spread object
var c = {...a, ...b};
forEach & new
var c = {} Object.keys(a).forEach(k => c[k] = a[k]); Object.keys(b).forEach(k => c[k] = b[k]);