Why is .NET faster than C++ in this case?

后端 未结 13 1447
长发绾君心
长发绾君心 2021-02-02 00:59

Make sure you run outside of the IDE. That is key.

-edit- I LOVE SLaks comment. \"The amount of misinformation in these answers is staggering.\" :D

相关标签:
13条回答
  • 2021-02-02 01:44

    If that code is truly 1/2 the execution time then some possible reasons are:

    • Garbage collection speeds up execution of C# code over C++ code if that were happening anywhere in the above code.
    • The C# writing to the console may be buffered (C++ might not, or it might just not be as efficient)
    0 讨论(0)
提交回复
热议问题