4 ms·
> making it very easy to go from O(n) to O(2n) Strictly speaking I assume everyone knows O(n) = O(2n) =O(kn) for k in R. But I see your point. I assume any de
by KolmogorovComp 4mo ago
> making it very easy to go from O(n) to O(2n)
Strictly speaking I assume everyone knows O(n) = O(2n) =O(kn) for k in R.
But I see your point. I assume any decent compiler would merge the loops though
- cupofjoakim 4mo agoFair! That'd depend on the operations right? For example, AFAIK typescript can't do much about multiple chained `map` calls, and i've seen quite a few `.filter(...).map(...).filter(Boolean).map(...)` :/
- c0balt 4mo agoTo be fair this likely should be handled by the interpreter/compiler for the compiled JS. V8 probably can merge this into one loop or another similar based on runtime types
- keithasaurus 4mo agoYes, blorp does that. And it also allows local mutation and loops inside pure functions, so performance doesn't need to be left on the table in most cases.