从Visual Studio启动时,发布版本比“正常"启动时更快. [英] Release Build is faster, when started from Visual Studio than started "normally"

查看:131
本文介绍了从Visual Studio启动时,发布版本比“正常"启动时更快.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Qt应用程序,目的是可视化工件.因此,我们使用Qt的OpenGL接口QGLWidget.在此应用程序中,有时我们必须加载和可视化大量数据(3D中最多4GB的双点).然后,应用程序变慢,但这无关紧要,因为性能在这里并不是真正的问题.渲染一帧通常需要100毫秒左右.

I have a Qt application which has the purpose to visualize workpieces. Therefore we are using Qt's OpenGL interface QGLWidget. In this application, we sometimes have to load and visualize a lot of data (up to 4GB of double points in 3D). The application then gets slow, but this does not matter, because performance is not the real problem here. Rendering one frame usually takes around 100 ms.

我们要解决的问题如下: 此后,当程序创建大量数据并加载了数据时,通常需要大量RAM.从Visual Studio启动应用程序时,内存分配比正常"启动时要快得多.

The problem we are approaching is the following: After the moment, when the program created the heavy data and we have loaded it, we normally need a lot of RAM. The allocation of the memory is a lot of faster, when the application is started from Visual Studio, than when started "normally".

在任务管理器中,我看到,增加所需内存的速度非常不同.一个应用程序每秒可以分配1GB的内存,而另一个应用程序每秒只能分配50MB的内存.

In the task-manager I can see, that the speed of the increasing needed memory is very different. While the one application can allocate like 1GB of memory in a second, the other one can only allocate like 50MB per second.

我的问题是,从Visual Studio启动应用程序时有什么区别?两次,我们都使用VS的"defaullt" Release版本.什么会引发此类问题?如何确定这些问题的根源?

My question is, what is the difference, when an application is started from Visual Studio? Both times, we are using the "defaullt" Release build from VS. What can trigger such kind of problems and how can I determine the source of these problems?

其他信息:此应用程序基于Qt5.该应用程序有10年的历史版本,使用Qt3和Qt4进行编程.我们不再有此应用程序的来源.当使用Qt3/4时,我们不会解决这些问题.看来旧应用程序的行为是相同的,就像Qt5应用程序是用VS启动时一样.
我们正在使用Visual Studio 2015和Qt5.9.1

Additional information: This application is based on Qt5. There is an 10 year old version of this application, programmed with Qt3 and Qt4. We don't have the sources of this application anymore. When used Qt3/4, we don't approach these problems. It seems like the behaviour of the old app is the same, as when the Qt5 application is started with VS.
We are using Visual Studio 2015 and Qt5.9.1

我跟踪了CPU使用率和内存使用率的时间:

I traced both times CPU usage and memory usage:

使用Visual Studio:

With Visual Studio:

没有Visual Studio:

Without Visual Studio:

您可以看到,第一个内存的增加比第二个要快得多.

You can see, that the increasing of the memory size of the first one is much faster, than the second one.

推荐答案

事实证明,您看到的区别是,当连接调试器时,操作系统/调试器将锁定某些页面,以使这些页面可立即用于调试器.这是一种特殊情况,因为您已连接调试器,一般不建议这样做.我相信没有快速解决方案-也许只是以不同的方式使用opengl.

It turns out that the differences you are seeing is that when a debugger gets attached, the OS/debugger will lock some pages so that they are immediately available to the debugger. This is an exceptional condition because you attached a debugger and isn't recommended in generel. I believe there is no quick fix - perhaps only to use opengl in different ways.

另请参阅以下可能具有相同原因的答案:

See also this answer that probably had the same cause:

已连接调试器的C ++/opengl应用程序运行更加流畅

这篇关于从Visual Studio启动时,发布版本比“正常"启动时更快.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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