Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Delete vs destructure for objects without mutating
Measure the performance of delete versus removing a prop from an object without mutating
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/126.0.6478.153 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 126
Operating system:
iOS 17.5
Device Platform:
Mobile
Date tested:
2 years ago
Rest object
12.4M/s
delete - spread operator
8.4M/s
delete - assign
5.9M/s
delete - JSON.stringify
3.0M/s
View exact numbers
Test name
Executions per second
✓
Rest object
12,417,818 Ops/sec
delete - spread operator
8,363,628 Ops/sec
delete - assign
5,879,615 Ops/sec
delete - JSON.stringify
3,023,733 Ops/sec
Script Preparation code:
var obj = { a:1, b:2, c:3 }
Tests:
delete - assign
const copy = Object.assign({}, obj); delete obj.a
Rest object
const { a, ...rest } = obj;
delete - spread operator
const copy = { ...obj } delete obj.a
delete - JSON.stringify
const copy = JSON.parse(JSON.stringify(obj)); delete obj.a