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_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/122.0.6261.89 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 122
Operating system:
iOS 17.3
Device Platform:
Mobile
Date tested:
2 years ago
Rest object
15.7M/s
delete - spread operator
11.3M/s
delete - assign
8.5M/s
delete - JSON.stringify
4.3M/s
View exact numbers
Test name
Executions per second
✓
Rest object
15,729,866 Ops/sec
delete - spread operator
11,272,174 Ops/sec
delete - assign
8,461,068 Ops/sec
delete - JSON.stringify
4,289,603 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