Many operations are optimized for typical use cases, for instance calling C# `string.Join` on short iterators will allocate no memory beyond that of the final string. The definition of "short" may be obscure (result is less than ~350 characters), but the optimization exists and is documented for anyone who cares enough about the tools in their toolbox.
I do agree with your general point, though. I remember a one-line change in a Haskell function that led to a 10x increase in performance:
I do agree with your general point, though. I remember a one-line change in a Haskell function that led to a 10x increase in performance:
https://news.ycombinator.com/item?id=6912474