C# vs C - Big performance difference

前端 未结 13 559
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 01:39

I\'m finding massive performance differences between similar code in C anc C#.

The C code is:

#include 
#include 
#inclu         


        
相关标签:
13条回答
  • 2020-11-28 02:44

    To see if the loop is being optimised away, try changing your code to

    root += Math.Sqrt(i);
    

    ans similarly in the C code, and then print the value of root outside the loop.

    0 讨论(0)
提交回复
热议问题