Build1 publisher2 min readPublished
Staying lazy until the sort cuts a chain's 80,000-object peak to about 2,000
TC39's iterator helpers are Baseline as of September 2026, so lazy chains run without a polyfill from Chrome 122 and Node 22 upward, while the teams reporting the 40-60% memory saving attached to them are unnamed.
The Engineer · Build desk

What happened
- A dev.to write-up says TC39's iterator helpers are officially Baseline Newly Available as of September 2026, so every evergreen browser supports them without a polyfill.
- The methods landed in Node 22 LTS, Bun 1.0, Chrome 122, Safari 17.4 and Firefox 131, and TypeScript 5.7 added the type definitions.
- Run on an iterator rather than an array, a map-filter-take(5) chain over 100,000 items processes exactly five items and allocates no intermediate arrays.
- The article's 50,000-user array chain peaks above 80,000 allocated objects to return 10 rows, with the map alone creating about 40,000 short-lived objects.
- Adopting teams are reported to see 40-60% memory reductions in data-heavy pipelines and 2-3x throughput improvements on large datasets.
Compiled by The EngineerSomething wrong?How this is made
Why it matters
- constraint Baseline Newly Available is a version floor, so the polyfill and the transpile target only come out of a build whose oldest supported engine clears every version on that list.
- decision Whether a Lodash chain can be deleted depends on what is in it: the five named helpers cover map, filter, take, drop and flatMap, and a chain with an ordering step still has to collect its input somewhere.
- contradiction One passage caps the filter predicate at five calls while another has the same filter passing about 80,000 of 100,000 items, so the call counts are illustrative.
- capability Chaining over Maps, Sets, generators and unbounded sequences becomes available in the standard library, which is work array methods could not do at any input size.
The worked example in the dev.to write-up does not fit inside the set of helpers it recommends. It lists `.map()`, `.filter()`, `.take()`, `.drop()` and `.flatMap()` as the native replacements for most Lodash chains [8]. The example filters 50,000 fetched users on `active`, maps them to two fields, filters again on a name prefix, sorts, and takes the first 10 [9]. Sorting means seeing every candidate, so a lazy version has to collect at the sort.
Most of the waste still goes. On the article's own estimated counts the second filter leaves about 2,000 items [10]. A pipeline that stays lazy through filter, map and filter, materialising only for the sort, peaks near 2,000 objects against the 80,000-plus the array chain reaches [1]. That is about a 40-fold cut. The counts behind it are estimates in a hand-built example.
One claim is worth checking before anyone repeats it. The article says that when `.take(5)` drives the chain over 100,000 items, the map transform runs five times and the filter predicate runs at most five times [6]. Earlier in the same piece, the filter over those 100,000 items passes about 80,000 [5]. If one item in five fails the predicate, five survivors take about six tests, since 5 divided by 0.8 is 6.25 [2].
The 40-60% memory reduction and the 2-3x throughput improvement are attributed to "teams that adopted iterator helpers in production codebases" [7]. The same piece discloses at the top that it "was written with the assistance of AI, under human supervision and review" [15]. For the throughput figure to transfer, a pipeline needs an early exit, because stopping the pull is what removes the work [4]. For the memory figure, the intermediate arrays have to be a real share of peak heap. The cost the article describes grows linearly with input size [11], so a chain over a few hundred rows has nothing to give back. The article says the garbage collector spends more time reclaiming temporary arrays than the code spends transforming data [12].
"Without a polyfill" is a statement about versions [2]. A service pinned to Node 20, or a browser matrix that still includes a Safari older than 17.4, sits below every engine the article lists [3], so the transpile target and the shim stay. TypeScript needs 5.7 or later for the type definitions [13].
The part I would adopt first is the part arrays never offered. The helpers work on Maps, Sets, generators and infinite sequences [14]. Array methods cannot chain over an unbounded sequence at all, because each step builds a full intermediate result before the next one runs [3].
What to watch
- A named benchmark with the workload and a heap profile, which would move the 40-60% figure from a report to a measurement.
- Whether the Baseline status for these methods advances past Newly Available, and how fast support matrices drop the versions below the floor.
- Any proposal for a lazy ordering or grouping helper, since the sort is what forces materialisation in the article's own example.