destructuring vs no

Benchmark created on


Setup

const item = { name: 'item', unitPrice: 123, imageHost: 'https://google.com', imagePath: '/image.png' }
const fn1 = ({ name, unitPrice: price, imageHost, imagePath }) => ({
        name,
        price,
        image: `https://${imageHost}${imagePath}`,
    })
const fn2 = (item) => ({
    name: item.name,
    image: `https://${item.imageHost}${item.imagePath}`,
    price: item.unitPrice,
})

Test runner

Ready to run.

Testing in
TestOps/sec
fn1
fn1(item)
ready
fn2
fn2(item)
ready

Revisions

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