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

前端 未结 7 1940
借酒劲吻你
借酒劲吻你 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:45

    The reason is because when you run your application within Visual Studio, the debugger is attached to it. When you run it using the profiler, the debugger is not attached.

    If you press F5 to run your program, even with the Release build, the debugger is still attached.

    If you try running the .exe by itself, or running the program through the IDE with "Debug > Start Without Debugging" (or just press Ctrl+F5) the application should run as fast as it does with the profiler.

提交回复
热议问题