Data structures that strongly require to be thread-safe are best candidates to become immutable objects. Moreover, as programmers can write mutable code that behaves in an immutable fashion, how to best achieve immutability? Does this programming approach really affect performance?



Watch it on YouTube

While Assembly is a language able to give instructions to the computer hardware, WebAssembly is an Assembly-like language able to drive a portable virtual stack machine. At present, not only all major browsers run an implementation of this VM, but WebAssembly bytecode can a...

Trampoline functions for large recursive loops

Large recursive loops may crash the JavaScript engine as large cycles will continue adding entries into the call stack until the JavaScript engine crashes. Trampoline functions wrap recursive functions in a loop, calling them until they no longer prod...

Watch it on YouTube

Immutability means that variables cannot be modified once they have been set with data, which prevents unwanted changes from occurring.

Immutability and pure functions

The concept of immutability is strictly connected with pure functions. In pure functions:

  1. Return val...

Watch it on YouTube

Each time an element of the DOM changes, the browser will have to recalculate elements and styles and also it might have to re-flow the page. The following is the typical workflow:

Recalculate Style → Layout → Paint

  1. Recalculate Style: changing the DOM causes the browser t...