Caching side-effects
By detecting that no changes have been made in a collection, you can skip the side-effect that would otherwise iterate over the collection, possibly running transformations along the way. Essentially, you're caching the side-effect. Usually, when you cache functions, you cache a value that's returned by the function. Side-effects are different because they effect the external environment in some way. For example, a UI component that uses an Immutable.js collection has been rendered. You then ask the component to render itself again, even though the collection that it uses hasn't changed at all. This side-effect can simply be ignored since it's already represented by the UI.
Let's build a generic mechanism that can be ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access