ES6 Destructuring cost

Are we still paying for object instantiation for ES6 destructuring?

I can see where it might be useful for cases where objects already exist, but I also have this bad feeling people are going to start creating objects when they don’t need to (but maybe they can be optimized away?).

var [x, y, z] = [1, 2, 3]; // ZOMG! I just created an array I'm never using!

Honestly, you can’t count on promises from implementors. Best to make something kick-ass that pushes generator performance, gets adoption, and engines feel the heat. Until then, profile twice, cut once – in all cases I’ve seen, the generator perf hardship was not on critical path.

Hey @senocular, look here! Saw this today:

Performance improvements
Ruby 2.4 also contains the following performance improvements including language changes:

Array#max, Array#min
[x, y].max and [x, y].min are optimized to not create a temporary array under certain conditions.

Woohoo! I wonder what conditions are involved…? Only when using a 2(-) element array?