JavaScript Engine optimization during closure
Lakshya Thakur

Lakshya Thakur @lakbychance

About: I like to have creative insights towards my subjects and apply my engineering skills for problem solving.

Location:
Gurgaon,India
Joined:
Apr 14, 2020

JavaScript Engine optimization during closure

Publish Date: Jan 8 '21
8 2

TIL that Javascript engines optimize out unused variables available in outer lexical environment if they aren't used inside nested functions.

Earlier I used to think this is the default Spec behaviour but it's rather an optimization 💡.

In this video, we see how exactly Firefox confirms that for us !!

Comments 2 total

  • var-che
    var-cheJan 9, 2021

    People really underestimate the power of JS engines, and what you pinpointed in this video is just a spec in a sea of optimizations within those engines. They all utilize cutting edge of optimization techniques, and this example with closures is not new.
    Anyway, good video.

  • Harshil Parmar
    Harshil ParmarJan 13, 2021

    Thanks for sharing 🙌

Add comment