Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile time comparison between Windows GCC and MSVC compiler

We are working on reducing compile times on Windows and are therefore considering all options. I've tried to look on Google for a comparison between compile time using GCC (MinGW or Cygwin) and MSVC compiler (CL) without any luck. Of course, making a comparison would not be to hard, but I'd rather avoid reinventing the wheel if I can.

Does anyone know of such an comparison out there? Or maybe anyone has some hands-on-experience?

Input much appreciated :)

like image 459
larsmoa Avatar asked Mar 11 '10 16:03

larsmoa


1 Answers

Comparing compiler is not trivial:

  • It may vary from processor to processor. GCC may better optimize for i7 and MSVC for Core 2 Duo or vice versa. Performance may be affected by cache etc. (Unroll loops or don't unroll loops, that is the question ;) ).
  • It depends very largely on how code is written. Certain idioms (equivalent to each other) may be preferred by one compiler.
  • It depends on how the code is used.
  • It depends on flags. For example gcc -O3 is known to often produce slower code then -O2 or -Os.
  • It depends on what assumption can be made about code. Can you allow strict aliasing or no (-fno-strict-aliasing/-fstrict-aliasing in gcc). Do you need full IEEE 754 or can you bent floating pointer calculation rules (-ffast-math).
  • It also depends on particular processor extensions. Do you enable MMX/SSE or not. Do you use intrinsics or no. Do you depend that code is i386 compatible or not.
  • Which version of gcc? Which version of msvc?
  • Do you use any of the gcc/msvc extensions?
  • Do you use microbenchmarking or macrobenchmarking?

And at the end you find out that the result was less then statistical error ;)

Even if the single application is used the result may be inconclusive (function A perform better in gcc but B in msvc).

PS. I would say cygwin will be slowest as it has additional level of indirection between POSIX and WinAPI.

like image 54
Maciej Piechotka Avatar answered Sep 30 '22 06:09

Maciej Piechotka