English 中文(简体)
从32位系统迁移到64位系统时,如何避免结果发生变化?
原标题:How to avoid results change when moving from 32 bit to 64 bit system?
  • 时间:2010-10-20 23:57:24
  •  标签:
  • c++

最近,我在64位系统上运行了我的C++程序,该程序是在32位系统中构建和调优的,我注意到有一些糟糕的性能变化。在我的代码中,我使用了很多浮点变量。现在我怀疑这可能是这些糟糕变化的原因。当代码从32位系统移动到64位系统时,是否有任何方法可以避免这种性能变化?谢谢你的帮助。

问题回答

我对此不是100%确定(可能接近20%),但如果32位浮点变量紧密地封装在一个数组或结构中(您提到它是为32位调优的),那么每一秒都可能“错位”,从而导致读取/写入该地址的开销/延迟。理想情况下,对象应该在64位系统的8字节边界上对齐。在某些系统上,对象必须正确对齐。

我怀疑你是否使用了很多浮点变量。更有可能的是,该系统(你没有给出任何细节)正在糟糕地运行32位->;64位。

典型的例子是运行一个为Windows 32位编译的程序,然后在安腾2 Windows 64位系统上运行。支持这种操作的WoW64子系统需要将x86指令转换为安腾指令,并支持32位应用程序的地址空间。安腾指令与x86非常不同。然而,在x64上做同样的事情会便宜得多,因为x64指令有点像x86的超集。

我希望这能有所帮助。由于我对你的具体情况一无所知,我不确定在这一点上我能不能帮你更多。





相关问题
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?

热门标签