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

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

c# - The item with identity 'Id' already exists in the metadata collection. Parameter name: item -

c++ - Redefined variable in the other module -