VS2010的性能差异,当调试/剖析 [英] VS2010 Performance differences when debugging/profiling

查看:185
本文介绍了VS2010的性能差异,当调试/剖析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[见编辑@底部 - 这个问题可能不是我最初以为]

[See edit @ the bottom - the problem may not be what I initially thought]

大家好,

我正在写它处理了一些过滤器/效果,包括模糊图形库。

I'm writing a graphics library which handles a number of filters/effects including blur.

我一直在尝试优化我的code和所遇到的事情,我不明白...

I've been trying to optimise my code and have come across something I don't understand...

当我运行code的没有的性能向导,在一个小图像的简单的3x3模糊可能需要几秒钟(远远超过它应该)。如果我这个延迟期间中断执行,我得到:

When I run the code without the performance wizard, a simple 3x3 blur on a small image can take a few seconds (far longer than it should). If I break execution during this delay, I get:

No Source Available
System.dll!Microsoft.Win32.SystemEvents.WindowThreadProc() + 0xc2 bytes

地址是运行/点击之间是一致的。

The address is consistent between runs/clicks

如果我运行通过性能向导的code,模糊效果发生在明显的延迟。

If I run the code via the Performance Wizard, the blur effect happens with no noticeable delay.

我可以看到,该CPU是50%(双核CPU,没有多线程的ATM使杏1核心)的任何方法,我用它来开始我的应用程序的模糊的时间。

I can see that the CPU is at 50% (dual core CPU, no multi-threading ATM so maxing out 1 core) for the duration of the blur whichever method I use to start my app.

如果我扩大了模糊的复杂性得到明显的延迟,我推测至少有2个数量级的附加探查提高性能。

If I scale up the complexity of the blur to get noticeable delays, I'd guesstimate that attaching the profiler improves performance by at least 2 orders of magnitude.

我试图从调试切换到发布版本的定义,并得到同样的结果。

I've tried switching from Debug to Release build definition and get the same result.

有人能向我解释为什么我的code将运行连接速度更快的探查?这感觉就像我在做一个愚蠢的错误的地方

Can someone explain to me why my code would run faster with a profiler attached? It feels like I'm making a silly mistake somewhere

编辑:

方案/速度:

  • 在Windows XP中:
    • 在VS调试:
    • 在VS剖析:快
    • 在调试/发布VS外构建:快
    • On Windows XP:
      • Debugging within VS: Slow
      • Profiling within VS: Fast
      • Debug/Release Build outside VS: Fast

      我然后切换到我的第二台机器,得到了...

      I then switched to my second machine and got ...

      • 在Windows 7中:
        • 在VS调试:
        • 在VS剖析:快
        • 在调试/发布VS外构建:快
        • On Windows 7:
          • Debugging within VS: Fast
          • Profiling within VS: Fast
          • Debug/Release Build outside VS: Fast

          这似乎表明我误识别问题 - 这不是探查正在改善的事情,它是在IDE的调试杀死它......我开始并没有犯罪嫌疑人的调试是问题,因为我开始开发Win7的机器,没有任何问题的,然后切换到XP的机器,并假设速度变化是由于硬件差异。直到我开始分析,我看到如何迅速跑了......

          Which seems to indicate I've mis-identified the problem - It's not that the profiler is improving things, it's that debugging in the IDE is killing it... I didn't initially suspect debugging was the issue as I started developing on the Win7 machine which had no issues then switched to the XP machine and assumed the speed change was due to hardware differences. It wasn't until I started profiling that I saw how quickly it ran...

          推荐答案

          这是一个总的猜测,但视觉工作室使用管理权限运行,但你的程序是不是?基本上,你在启动Visual Studio时得到UAC推广对话框,因此如果通过调试/测试运行那里,你可以最大一个CPU,而是一个用户空间的过程可能不会被允许?一个相关的问题是要问,如果你要使用调试器(而不是探查器),或者未在运行时的性能改善。

          This is a total guess, but is visual studio running with administrative rights, but your program is not? Basically, are you getting the UAC promotion dialog when launching visual studio, and thus if run through the debugger/profiler there, you can max a CPU, but a "user-space" process may not be allowed to? A related question would be to ask if you're getting the performance "improvement" when running with the debugger (not profiler) or not.

          总猜测,但也可以是一个地方开始寻找

          Total guesswork, but may be a place to start looking.

          这篇关于VS2010的性能差异,当调试/剖析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆