257. counts stays a compiler builtin until a generator passed to a Seq parameter streams (2026-11-22)
- Decision. Revert
068f144ec(countsasstd.hashmap.countsoverCounter):lower_countsand the synthetic counter structs come back, the std body and its prelude line go. The Q3 perf gate (decision 256's direction, Q3 default (a)) now also compares peak memory on a generator argument, not only time on a list. - Why.
counts(i % 1000 for i in 0..n)at n = 2e7: builtin 0.08 s and 3328 KB; the std body 0.21 s and 264908 KB, because a generator passed toS: Seqis materialized into a list before the body runs, while the builtin folds it in place.prodpasses the same gate: builtin and std both 133836 KB and 0.10-0.13 s, since the builtin materialized too. - Reverse. Once a generator argument to a generic
Seqparameter streams (compiler worklog request), re-apply068f144ecand rerun the same two benchmarks.