|
|
|
|
|
by Cthulhu_
1670 days ago
|
|
Plus they may have hidden performance costs - or benefits. They may have function invocation and memory layout costs, but they may also be parallelised and optimized transparently. A regular for-loop is super efficient in terms of memory layout / access but it's by definition singlethreaded. |
|
Presumably the exact semantics of a for-type loop depends on the language, but surely the C standard doesn't prevent auto-parallelization (including with SIMD vectorization, modulo arithmetic rules). Loops might also have OpenMP or other annotation.