Delete vs. Spread Extract

Benchmark created on


Description

In some cases - e.g. database filters you really need to delete a prop instead of just setting in undefined. (Cause obj.text = undefined will search for objects with text undefined)

Setup

const obj = {a: 1, b: 2}

Test runner

Ready to run.

Testing in
TestOps/sec
delete
delete obj.a
ready
spread and extract rest
const {a, ...rest} = obj
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.