Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
JavaScript Object.assign vs for in loop
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0
Browser:
Firefox 142
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
for in loop
27.6M/s
Object.assign
17.5M/s
View exact numbers
Test name
Executions per second
✓
for in loop
27,631,750 Ops/sec
Object.assign
17,541,160 Ops/sec
Tests:
Object.assign
const a = { x: 'xxx', y: 1, z: null } const b = { z: 1, u: 'uuu', v: null } Object.assign(a, b);
for in loop
const a = { x: 'xxx', y: 1, z: null } const b = { z: 1, u: 'uuu', v: null } for (let prop in b) a[prop] = b[prop];