Interesting question came up today. Is the "memory usage" increase worth using JavaScript ES6 destructuring? Never knew that might ever be a problem and still doubt it is a big one but curious what people think. @syntaxfm what do you think?
-
-
Replying to @jamesqquick @syntaxfm
Not sure since I don’t know how the low-level implementation works, but I would like to think if it’s a const the JS engine would use a reference to the same value to save CPU cycles. At the JS level we expect a new variable but I expect a smart JS engine would optimize for this.
3 replies 0 retweets 0 likes
In general, I’d recommend focusing on writing readable code. If using destructuring makes sense, then go ahead and do it. Let the JS engine worry about making it fast and memory-efficient. What increase in memory usage related to destructuring are you referring to exactly?
5:15 AM - 12 Dec 2018
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.