English 中文(简体)
C++ “支离破碎”缓慢。 我应首先研究什么?
原标题:C++ "delete" is slow. Where should I look first?

我有一份C++应用程序,“专用”功能运行缓慢。 是什么原因,我何时开始寻求解决办法?

<<>Background:

This C++ code is in an ARX file running inside of AutoCAD, which is basically just a DLL.

删除速度缓慢的具体计算机是2011年自动开发会议,Windows 7, 64-bit。 ARX 用于2011年自动开发会议,必须使用2008年图像材料包1加以汇编。

The computer with the problem is a customer s computer. It does not have any version of Visual Studio installed on it.

在我的开发计算机上,《刑法》在2011年常设东京会议上没有任何问题。

为了测试,我有一些删除相关名单的法典。 在有问题的计算机上,删除清单需要0.7秒。 在电脑和配置上,同样的代码为0.02秒。 具体时间并不重要,两者大不相同。

我确信,在这两台电脑上操作同样的版本的代码,因此这不是一个释放问题,而是一个 de问题。

最佳回答

大约按命令检查:

  • Other plugins: could that behavior caused by other ARX files? Can they be disabled on bad system?
  • PerfMon: Check if soft/hard page faults or cache misses peak during your delete (I hope you can set that up on the customers computer).
  • HeapQueryInformation: same values in good/bad environment?
  • Heap Lock: Could some other thread be highly active in the background, holding tight to the heap s lock? You could test by wrapping the loop in HeapLock / HeapUnlock (and time inside the lock, of course).
  • Hooks: Could the respective code be hooked? (e.g. a 3rd party app hooking into the C++/Win32 Heap functions to do whatever it wants to do)
  • Grasping at straws: Do the respective new s take unusually long? How are the individual delete times distributed?
问题回答

这可能是由于工作/出勤制度之间不同的切身效率。 对于造成大量切除而使海滩消失的失灵系统,可能会有更多的记忆。 在静脉系统上,数据可能更趋连续,在大删除期间会受到更多的切身打击。

Try the British Performance Counter Monitor?

如果可以接受并有可能,那么就试图在客户电脑上使用一个简介员。

您可尝试AMD CodeAnalyst或英特尔(但并非免费)。

如果无法做到这一点,那么在你的释放中添加特征分析法,并从客户那里收集结果。 即使是简单的描述法也可帮助你找到真正的瓶颈。

它并不认为删除本身是问题,但问题可能是该法典的一部分。

E.g. - 什么类型的head->resval.rstring?

整整整段时间。 删除数千件物品,即使释放方式,也只能用几秒钟(我已经看到几分钟)。

答案是不要删除。 选择真正的记忆分配器,而不是单独分配每个物体,而是建立记忆库(或定制的斜坡或你想要称之为的)。 基本上,一个库是记忆的一部分,你们的物体将从中分配。 你们仍为每个目标分配记忆,但从资源库而不是直接从监督厅那里取。

当删除时间时,你只是删除了整个集合,而不是逐一删除物体。 每一批同时到期的物体使用不同的集合。 你们不需要为整个集体分配记忆,但你只能一劳永逸地全部删除。

How is the retlist being generated? Additionally, Is there a reason you are allocating and deleting the resbufs manually instead of using acutNewRb and acutRelRb?

另外,你可能已经检查了这些数据,但用户在2009年和2011年自动东京会议上是否都装上了缺省图? 如果不是的话,这些绘画是否相同(除东京会议版本外),是否位于当地,或放在网络驱动上? 您还可以研究用户是否拥有相同的标准。 在上述两种情况下均可申请净额/目标数。 另外,2011年自动开发会议是否是一个网络或当地安装?

最后,你可能想在问题中添加自动和物体标签。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签