# ES6 Destructuring cost

**URL:** <https://forum.kirupa.com/t/es6-destructuring-cost/331731>\
**Category:** web dev\
**Created:** [October 7, 2013, 2:32pm UTC](https://forum.kirupa.com/t/es6-destructuring-cost/331731 "2013-10-07T14:32:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [October 7, 2013, 2:32pm UTC](https://forum.kirupa.com/t/es6-destructuring-cost/331731/1 "2013-10-07T14:32:03Z")

</div>

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?).

```auto

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

```

> **[Venntro Development](https://dev.venntro.com/)**
>
> Powering the technology behind one of the world's leading social discovery and online dating companies

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [April 29, 2015, 11:44pm UTC](https://forum.kirupa.com/t/es6-destructuring-cost/331731/2 "2015-04-29T23:44:01Z")

</div>

[https://esdiscuss.org/topic/understanding-future-performance-profiles-of-generators](https://esdiscuss.org/topic/understanding-future-performance-profiles-of-generators)

> 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.

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [June 23, 2016, 7:07am UTC](https://forum.kirupa.com/t/es6-destructuring-cost/331731/3 "2016-06-23T07:07:02Z")

</div>

Hey @senocular, look here! Saw this today:

[https://www.ruby-lang.org/en/news/2016/06/20/ruby-2-4-0-preview1-released/](https://www.ruby-lang.org/en/news/2016/06/20/ruby-2-4-0-preview1-released/)

> **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.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [June 27, 2016, 3:47pm UTC](https://forum.kirupa.com/t/es6-destructuring-cost/331731/4 "2016-06-27T15:47:06Z")

</div>

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