Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
forEach mutate object vs map spread copy v2
add field into object with forEach vs spread fields into new object with new field in array of objects
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Browser:
Chrome 124
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
map
1069038.4 Ops/sec
forEach
1182387.2 Ops/sec
Tests:
map
const objects = [ { a: 'XzWtv', b: 'sFqrG', c: 'qCbnP' }, { a: 'yjkAu', b: 'vMhlE', c: 'xPqro' }, { a: 'wNztX', b: 'gDypR', c: 'iHklL' }, { a: 'mQjvs', b: 'dKzpt', c: 'aVbcO' }, { a: 'bUefZ', b: 'cRiyG', c: 'uTqxs' } ] objects.map(el => ({...el, d: Math.random()}))
forEach
const objects = [ { a: 'XzWtv', b: 'sFqrG', c: 'qCbnP' }, { a: 'yjkAu', b: 'vMhlE', c: 'xPqro' }, { a: 'wNztX', b: 'gDypR', c: 'iHklL' }, { a: 'mQjvs', b: 'dKzpt', c: 'aVbcO' }, { a: 'bUefZ', b: 'cRiyG', c: 'uTqxs' } ] objects.forEach(el => {el.d = Math.random()})