destructuring vs no (v2)

Revision 2 of this 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,
    price: item.unitPrice,
    image: `https://${item.imageHost}${item.imagePath}`,
})
const fn3 = ({ name, unitPrice: price, imageHost, imagePath }) => ({
        name,
        price,
        image: 'https://' + imageHost + imagePath,
    })

Test runner

Ready to run.

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

Revisions

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