MinGW g++从 4.5.0 更新到 4.6.2 后性能损失
今天我更新了 MinGW 并重建了我当前的 C++ 项目。自从使用 4.5.0 以来,我已经记录了计时信息,并且在使用 4.6.2 版本进行编译时,我看到了巨大的性能损失(大约慢了 4 倍)。
我的构建命令:
g++ -Ilib\svl-1.5\include -Ilib\SDL-1.2.15\include -static-libgcc -static-libstdc++ \
-Ofast -O3 -oecl.exe src\ecl.cpp -lmingw32 -lSDLmain -lSDL -std=c++0x
我在 Window 64 位系统上运行 MinGW。
您知道是什么导致了糟糕的表现吗?
我的 bin 文件夹包含一个名为 mingw32-gcc-4.5.0
的文件。 MinGW 4.6 发行说明页面 表示它可以用于与旧版本一起编译。不幸的是,g++ 没有这样的二进制文件。我读到 gcc 也能够编译 C++,但它在我的情况下不起作用,我只是收到大量错误。我只在人们询问如何使用 gcc 编译 C++ 程序的网站上找到使用 g++ 的提示。
有没有办法使用 mingw32-gcc-4.5.0
编译我的 C++ 程序?如果没有,是否有其他方法使用 4.5.0 版本进行编译? 我想确保糟糕的性能不是由代码更改引起的。
编辑
我通过运行 2010 年下载的旧 MinGW 安装程序成功地再次安装了 4.5.0。我将代码和构建批处理文件恢复到昨天的状态。还是表现不好。 MinGW 是否在其安装目录之外安装 DLL 或其他相关文件?
Today I updated MinGW and rebuilt my current C++-project. I've logged timing-info since using 4.5.0 and I see a huge performance loss (about 4 times slower) when compiling with version 4.6.2.
My build-command:
g++ -Ilib\svl-1.5\include -Ilib\SDL-1.2.15\include -static-libgcc -static-libstdc++ \
-Ofast -O3 -oecl.exe src\ecl.cpp -lmingw32 -lSDLmain -lSDL -std=c++0x
I'm running MinGW on a Window 64 bit system.
Do you have any idea what causes that bad performance?
My bin-folder contains a file called mingw32-gcc-4.5.0
. The MinGW 4.6 release notes page says that it can be used to compile with older versions. Unfortunately there is no such binary for g++. I read that gcc is also able to compile C++, but it doesn't work in my case, I just get tons of errors. I only found the hint to use g++ on sites where people asked how to compile C++ programs using gcc.
Is there a way to get my C++ program compiled using mingw32-gcc-4.5.0
? If not, is there another way to compile using version 4.5.0?
I want to ensure that the bad performance isn't caused by changes in my code.
Edit
I managed to install 4.5.0 again by running my old MinGW-installer downloaded in 2010. I reverted my code and build-batch file to the state of yesterday. Still bad performance. Is MinGW installing DLLs or other related files outside of its installation directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定这是否适用于您的情况,但我听说某些版本的 MinGW 会在
\MinGW
中查找文件/程序/DLL,即使当前运行的 MinGW 来自不同的版本地点。我不确定此行为可能适用于哪个版本,但我建议您仅当它是计算机上安装的唯一 MinGW 工具链时才使用
\MinGW
进行 MinGW 安装。找到此建议的来源:
I'm not sure if this would apply to your situation, but I have heard that some versions of MinGW will look in
\MinGW
for files/programs/DLLs even if the currently running MinGW is from a different location.I'm not sure what version(s) this behavior might apply to, but I'd suggest that you use
\MinGW
for a MinGW installation only if it's the only MinGW toolchain installed on the machine.Found the source of this advice:
重新启动是解决方案。它再次适用于 4.5.0 和 4.6.2 两个版本。现在用 4.6.2 编译的 binaray 性能更好。
在更新MinGW之前,我的程序的性能一直很稳定,因此我并没有意识到这是我的系统的问题。
但这就是我们的思维方式:如果两件相关的事情同时发生,我们就会认为第一件事导致了第二件事。魔术师正在利用这个事实:P
Rebooting was the solution. It works again with both versions, 4.5.0 and 4.6.2. Now the binaray compiled with 4.6.2 performs even better.
The performance of my program has always been stable before updating MinGW, therefore I didn't came to the idea that it was a problem with my system.
But that's how our minds work: If two related things happen at the same time we think the first thing causes the second one. Illusionists are exploiting that fact :P