3 ms·
Loop unrolling, inlining, dead code elimination does not change the asymptotical complexity of the program. This optimisation does.
by pkolaczk 13y ago
Loop unrolling, inlining, dead code elimination does not change the asymptotical complexity of the program. This optimisation does.
- bstamour 13y agoIt's not an optimization: it's move semantics. And it's default behaviour for any standards-conforming compiler. Moves can be optimized away still, but by default, returning a std::vector from a function is a constant-time operation.
- Someone 13y agoConstant folding can (theoretically) turn a O(N) loop into constant-time, and may trigger further dead code elimination. Your typical template metaprogram for computing Fibonacci numbers will do the same. The time when mortals could more or less 'see' what the memory usage and execution time of a C++ code fragment are is well beyond us.