C++ performance, for versus while
问题 In general (or from your experience), is there difference in performance between for and while loops? What if they are doubly/triply nested? Is vectorization (SSE) affected by loop variant in g++ or Intel compilers? Thank you 回答1: Here is a nice paper on the subject. 回答2: Any intelligent compiler won't really show a difference between them. A for loop is really just syntactic sugar for a certain form of while loop, anyways. 回答3: This is something easily ascertained by looking at disassembly.