c++ - What is faster from an performance standpoint of view? -


Which sequential implementation will be faster than the viewpoint's performance (I know that the second person has more memory and time RAM Type in value):

 for  (int j = 3; j & lt; = ceil (sqrt (i)); j ++} {...}  < (Pre j ; 

  int max = ceil (sqrt (i)); for (int j = 3; j & lt; = max; j ++) {.. .}  

There is something with it that how the compiler behaves with this code indicates where to answer for the answer.

PS: Plazes do not suggest a bold and straightforward way of checking the performance by simply running it. I should remember that the architecture of the underlying systems can be quite different then the first case can win on an architecture Whereas, the second case may be dominated by another, this is the reason why I need a clearly defined treatment of both, which may be the compiler specification, let's go Take to limit GCC. Will question what point: Which compiler specs portion I will look to find it?

I think it depends if the compiler is able to prove that I can not Can not replace sqrt () and cit () is not changed during execution. If the compiler can not be sure that I remain stable during execution, then there is no alternative to repeatedly evaluating the seat (sqrt) in the first instance.


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -