Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's a different question</p> <blockquote> <p>Why do you think such a small optimization will matter in the greater context of your program?</p> </blockquote> <p>I find it <strong>highly</strong> unlikely that a micro-optimization such as this will have an perceivable impact on your program. You should never micro-optimize like this unless a profiler has specifically shown this to be a problem. </p> <p><strong>EDIT</strong> Adding some clarification buried in the comments</p> <p>The reason there is no great answer to this question is that the performance of that code is highly dependent upon ...</p> <ol> <li>The way in which it's used in your program</li> <li>The particular compiler you're using</li> <li>The optimization flags passed to your compiler</li> <li>The particular architecture you are running the code on </li> <li>Many other very tiny things that weren't included in the question</li> </ol> <p>Even if all of this information was included, our answers would be guesses at best. The only way to answer this question is to whip out a profiler and find out which is faster. </p> <p>However this is almost certainly not worth the effort. Micro-optimizing such a small piece of your program will almost certainly not add any noticable preformance benefits to your code. In general it's a really bad idea to optimize code like this unless the profiler specifically tells you it's a problem. Otherwise you'll spend a lot of time optimizing something for no percievable benefit. </p> <p>Yes there are cases where such an optimization could be important. But that would be only in a <strong>very special</strong> circumstances where the code was a part of a very tight highly called loop. However the only way to identify such code is to use a profiler. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload