Performance comparison between Windows gcc compiled and Visual Studio compiled

I am currently compiling an open source optimization library (native C ++) that comes with makefiles for use with gcc. Since I am a Windows user, I am curious about the two options that I see in compiling, using gcc with MinGW / Cygwin or manually creating a Visual Studio project and compiling the source code.

1) If I compile using MinGW / Cygwin + gcc, will the resulting .lib library (static library) contain any libraries from MinGW / Cygwin? That is, can I distribute my compiled .lib to a Windows PC that does not have MinGW / Cygwin and will it run?

2) Besides the performance differences between the compilers themselves, are there any costs associated with compiling using MinGW / Cygwin and gcc - as well as whether the emulation layer is compiled into a library or does gcc create its own Windows library?

3) If speed is my main goal of the library, which is the best way to use it? I understand that this is fairly open, and I can best use my own tests, but if anyone has experience, it will be great!

+4
source share
1 answer

The whole point of Cygwin is the level of Linux emulation, and by default (i.e. if you do not cross-compile), binaries need cygwin1.dll to run.

This does not apply to MinGW, which creates binaries as "native", like those from MSVC. However, MinGW comes with its own set of runtime libraries, specifically libstdc++-6.dll . This library can also be linked statically with -static-libstdc++ , in which case you also probably want to compile with -static-libgcc .

This does not mean that you can freely mix C ++ libraries from different compilers (see this page at mingw.org). If you do not want to limit yourself to the extern "C" interface in your library, you will most likely have to choose one compiler and stick with it.

As for your performance: using Cygwin only leads to a penalty (secondary?) In the actual interaction with the OS - in the case of unprocessed calculations, only the quality of the optimizer matters.

+5
source

All Articles