Anyone asking this question does not really know what he is talking about.
Any good compiler will and should generate identical code for ++i, i += 1, and i = i + 1. Compilers are meant to optimize code. The programmer should not be bother about such things. Also, it depends on the processor and compiler you are using. One needs to check the compiler's assembly language output, to see which one of the different approcahes are better, if at all.
Note that speed comes Good, well written algorithms and not from such silly tricks.
|