"Super" hoisting

Nicolas B. Pierron nicolas.b.pierron at mozilla.com
Fri May 13 16:21:54 UTC 2016


On Fri, May 13, 2016 at 4:13 PM, /#!/JoePea <joe at trusktr.io> wrote:
>> I do not understand how having local variable should change any GC pattern
>> unless you are creating them in the for-loop body.
>
> Having locals in a for-loop is the same as having locals in a function that
> gets called at 60fps in an animation loop (which is the case).

Scope wise, yes, but a different init value would be used every time.

var o = {};
for (var i = 0; i < 100; i++) {
  …
}

is different than

for (var i = 0; i < 100; i++) {
  var o = {};
  …
}


-- 
Nicolas B. Pierron


More information about the es-discuss mailing list