The cost of immutable data

By now you are well aware of the advantage immutable data brings to a Flux architecture—a level of assurance about our unidirectional data-flow. This safety net comes at a cost. In this section, we'll discuss how expensive immutability can be and what can be done about it.

We'll start by covering the biggest immutability issue—transient memory allocations and garbage collection. These things are big threats to the performance of our Flux architecture. Next, we'll think about lessening the amount of memory allocations by batching together transformations on immutable data. Finally, we'll think about the ways in which immutable data eliminates code that's only needed to handle scenarios where data is mutable.

Garbage collection ...

Get Flux Architecture now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.