|
|
|
|
|
by yen223
1984 days ago
|
|
If you're interested in what the code is trying to achieve, then `map`, `filter` and the like is clearly more explicit. If you're interested in what actually gets executed (if you're trying to optimize for performance, say), then the `for` loop is clearly explicit than the abstract counterparts. It depends on what what you're looking for. |
|
In what language? GCC will happily not just optimize away your counter variable but perhaps even replace your whole loop with an SIMD operation; I suspect the Go compiler will do the same.
Also, if you're trying to optimize for performance then looking at what code gets executed is (to first order) useless; the dominant factor is cache efficiency and you can't see cache hits/misses by reading the code.