[英]Why 64Bit version app is much slower than 32Bit version
In order to solve the 3G (Ubuntu) memory issue (sometimes we do need more memory than 3G), I compiled my app under a 64bit environment to use more memory. 为了解决3G(Ubuntu)内存问题(有时我们确实需要比3G更多的内存),我在64位环境下编译了我的应用程序以使用更多的内存。
But, my 64bit app is much slower than the 32bit version. 但是,我的64位应用程序比32位版本慢得多。
32Bit version is built on a 32 bit machine; 32位版本建立在32位计算机上; 64Bit version is build on a 64 bit machine;
64位版本建立在64位计算机上; both 32Bit and 64Bit versions run on the 64Bit machine in our loading test.
在我们的负载测试中,32位和64位版本均在64位计算机上运行。
I googled, and some folks said, the unnecessary long
type can make the 64bit slower than 32bit, because: 我用谷歌搜索,有些人说,不必要的
long
类型会使64位比32位慢,因为:
man g++:
-m64
Generate code for a 32-bit or 64-bit environment. The 32-bit environment
sets int, long and pointer to 32 bits and generates code that runs on any
i386 system. The 64-bit environment sets int to 32 bits and long and
pointer to 64 bits and generates code for AMD's x86-64 architecture. For
darwin only the -m64 option turns off the -fno-pic and -mdynamic-no-pic
options.
So I changed all my long
s to int
s, but still same result. 因此,我将所有
long
s都更改为int
,但结果仍然相同。
Please advise. 请指教。
Peter 彼得
Edit: 编辑:
Profile your app. 设定您的应用程式。 That will tell you where the slow code is.
这将告诉您慢速代码在哪里。
For the question "why", no one will know the reason without details. 对于“为什么”的问题,没有细节,没人会知道原因。 You must analyze the profiled result and if there are any problem with the result, post it as a question here.
您必须分析概要分析的结果,如果结果有任何问题,请在此处将其发布为问题。
If your app does not need more than 4GB of RAM (1.5~2.5GB in your case), you should try x32 . 如果您的应用程序不需要超过4GB的RAM(在您的情况下为1.5〜2.5GB),则应尝试x32 。 It's a new ABI that allows for 32-bit pointers in 64-bit environment.
这是一个新的ABI ,允许在64位环境中使用32位指针。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.