Low performance of generated code

chupakabra
2010-11-15
2013-06-06
  • chupakabra

    chupakabra - 2010-11-15

    Hello, I have a problem with low performance of code generated by MinGW-w64 compiler. I would like to know if I am doing something wrong or is it a problem of MinGW-w64 project. Problem description:

    1. Download project source code: http://farplug.googlecode.com/files/colorer.zip
    2. Compile using mingw-w32-1.0-bin_i686-mingw_20101015.zip package. Execute make -f makefile.mingw within colorer subdirectory.
    3. Run performance test: colorergcc -p1 -c ..\catalog.xml ConsoleToolsRunner.cpp
    I get 94 - 110 ms on my machine.

    Perform same steps once again but use GCC 4.5.0 from mingw.org to build project. Test executes two times faster now (47 ms on my machine).

     
  • Kai Tietz

    Kai Tietz - 2010-11-16

    Hello,

    it is pretty unlikely that gcc for mingw.org and mingw-w64 having differences in code-generations. Both ventures are using in general same vanilla sources. It is more likely that you ran into one regression for math in our runtime. To satisfy C99 we choose a valid, but slower implementation then the msvcrt variant (which is used by mingw.org). We fixed this issue already on our trunk version and it would be kind, if you could test your performance test with our trunk version of crt/headers, too.

    Kindly regards,
    Kai

     
  • chupakabra

    chupakabra - 2010-11-21

    I tested with recent package named mingw-w32-1.0-bin_i686-linux_20101119.tar.bz2 and problem still presents. Is it equivalent to testing with trunk version? If not can you build a package based on trunk?

     
  • tta

    tta - 2010-11-21

    I think this may be due to a difference regard of code generation: mingw.org GCC uses DW2 exception handling model, while mingw-w64 uses SJLJ , which is known to be slower.

    BTW, you may try the unofficial of mingw.org GCC from TDM, which also uses SJLJ to compare to mingw-w64 one:
    http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm-gcc-4.5.1.exe/download

    In addition, GCC 4.5.1 and later introduces "-flto" option to produce faster code (but it will increase compilation time), so you may try it, too.

    Be careful that DW2 is still unstable, even in case of mingw.org GCC (e.g multithread exception handling issue) and there's some drawbacks when using it.

     
  • chupakabra

    chupakabra - 2010-11-21

    You are right, slowdown is caused by using SJLJ exception model instead of DW2. Thanks for the hint.

     
  • chupakabra

    chupakabra - 2010-11-21

    Btw, do you plan to provide packages for building DW2 64bit targets?

     
  • Jonathan Yong

    Jonathan Yong - 2010-11-22

    No, SJLJ was chosen over DW2 because DW2 doesn't work on 64bit.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks