How do I find out why g++ takes a very long time on a particular file?

后端 未结 8 1387
日久生厌
日久生厌 2021-02-01 21:51

I am building a lot of auto-generated code, including one particularly large file (~15K lines), using a mingw32 cross compiler on linux. Most files are extremely quick, but thi

8条回答
  •  北荒
    北荒 (楼主)
    2021-02-01 22:28

    Another process to try is to add "progress marker" pragmas to your code to trap the portion of the code that is taking a long time. The Visual Studio compiler provides #pragma message(), although there is not a standard pragma for doing this.

    Put one marker at the beginning of the code and a marker at the end of the code. The end marker could be a #error since you don't care about the remainder of the source file. Move the markers accordingly to trap the section of code taking the longest time.

    Just a thought...

提交回复
热议问题