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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser:
Chrome 137
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
10 months ago
Test name
Executions per second
map
17035556.0 Ops/sec
forEach
22954522.0 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()})