Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Object.assign vs spread vs _.extend
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0
Browser:
Firefox 124
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
_.extend
4.8M/s
Object.assign
4.5M/s
spread operator
3.2M/s
View exact numbers
Test name
Executions per second
✓
_.extend
4,807,366 Ops/sec
Object.assign
4,499,716 Ops/sec
spread operator
3,161,757 Ops/sec
HTML Preparation code:
<script src="https://underscorejs.org/underscore-min.js"></script>
Tests:
Object.assign
var params = { b:"hello", c: true, d:7 }; var other = Object.assign({ a: 2 }, params);
spread operator
var params = { b:"hello", c: true, d:7 }; var other = { a: 2, ...params };
_.extend
var params = { b:"hello", c: true, d:7 }; var other = _.extend({ a: 2 }, params);