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

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

    turning on the profiler will end up moving your code around (a bit) which probably masking the problem.

    The most common cause of hiesenbugs is unitialized variables, The second most common cause is using memory after it has been freed(). Since your free seems to fix it, you might think to look for late references, but I would still look for uninitialized variables first if I were you.

提交回复
热议问题