Whilst destructuring is nice for code clarity, it may in many cases be a bad sacrifice given the inefficiency.

It is slow. No, I mean SLOW! If you're after performant code, this isn't it. The reason being it's not compiled out or operating as pointers. No, instead it's making extra copies. That means more RAM use and more CPU time spent shoving data around.

Much akin to the derpy callback functions on Array like "map" or "forEach", this can have a horrific impact -- 4 to 8x slower -- on your operations.

Now, in some cases that's not a big deal, like for something that's only run once. In those cases go for the clarity. Just beware if you're going to do it a lot in anything time sensitive or that takes up a lot of memory, you're shooting yourself in the foot.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store