Why does my program run way faster when I enable profiling?

前端 未结 7 1949
借酒劲吻你
借酒劲吻你 2020-12-06 00:58

I have a program that\'s running pretty slowly (takes like 20 seconds even on release) so, wanting to fix it, I tried to use Visual Studio\'s built in profiler. However, whe

7条回答
  •  借酒劲吻你
    2020-12-06 01:24

    In my case it was due to the Windows Timer Resolution.

    If you program uses threading, the System wide Timer resolution may be the reason for longer times when running through Visual studio.

    The default windows timer resolution is 15.6ms

    When running through profiler, the profiler sets this value to 1ms causing faster execution. Checkout this answer

提交回复
热议问题