liveBook · Manning

Method fusion

Method fusion is an optimization technique that combines compatible chained operations into fewer passes and intermediate data structures.

How 2 Manning books explain it

The Joy of JavaScript

An optimization technique that combines multiple chained operations into fewer passes over a data structure to reduce allocation and overhead.

How it is used
Optimizes chained array transformations by reducing passes, intermediate arrays, and allocation overhead.
How deep it goes
Explains the allocation tradeoff and composition technique, but stops short of detailed runtime implementation.
Examples
Uses composed versus chained array maps, plus flatMap replacing separate map and flat calls.
What you can do after
Apply method fusion by composing transformations or choosing flatMap to avoid unnecessary intermediate arrays.

Read how The Joy of JavaScript explains method fusion →

Functional Programming in JavaScript

A functional-programming optimization that combines compatible operations into fewer passes and fewer intermediate data structures.

How it is used
Optimizes functional pipelines by deferring execution and avoiding work that later operations do not demand.
How deep it goes
Demonstrates a Lodash chain and contrasts eager and lazy range processing, but does not detail fusion internals.
Examples
Demonstrates Lodash range, map, filter, take, and value operations over a sequence of numbers.
What you can do after
Apply shortcut fusion through a Lodash lazy chain that delays execution until value() and limits demanded results.

Read how Functional Programming in JavaScript explains method fusion →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.