fishbone
fishbone

Reputation: 3249

MinGW g++ performance loss after updating from 4.5.0 to 4.6.2

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?

Upvotes: 1

Views: 562

Answers (2)

fishbone
fishbone

Reputation: 3249

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

Upvotes: 0

Michael Burr
Michael Burr

Reputation: 340178

Is MinGW installing DLLs or other related files outside of its installation directory?

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:

Do not install TDM-GCC to "C:\MinGW"!

Previously, the recommended path to install MinGW at was "C:\MinGW". This is no longer the case -- because other versions of GCC search that path for headers and libraries even if they are not installed there. TDM-GCC has been patched to fix this problem, but most other MinGW/GCC distributions have not. This means that if you have more another installation of MinGW or MinGW-w64, it will always search for headers and libraries in "C:\MinGW", and you'll probably end up using the wrong headers and libraries inadvertently. Therefore, it's now recommended that you use a different path for your installation.

Upvotes: 2

Related Questions