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

后端 未结 13 1444
长发绾君心
长发绾君心 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:30

    Don't understand the answer with garbage collection or console buffering.

    It could be that your timer mechanism in C++ is inherently flawed.

    According to http://en.wikipedia.org/wiki/Rdtsc, it is possible that you get wrong benchmark results.

    Quoted:

    While this makes time keeping more consistent, it can skew benchmarks, where a certain amount of spin-up time is spent at a lower clock rate before the OS switches the processor to the higher rate. This has the effect of making things seem like they require more processor cycles than they normally would.

提交回复
热议问题