How should I detect bottleneck of compile time in a large C++ project?

后端 未结 4 1432
暖寄归人
暖寄归人 2021-02-18 15:41

I want to reduce compile time of a large C++ project. I tried to use precompiled headers, interface and etc. But before I move on, I want to know whether any tool which helps de

4条回答
  •  花落未央
    2021-02-18 15:55

    You could look into unity builds.
    Basically it's including all .cpp files into one .cpp file and only compiling that one file. I've tested it on a big project and it was really effective.
    It works because of it uses much less I/O when it includes all your headers/cpp's once and not for every cpp.

    Now we don't use unity builds anymore because we all got a SSD hardware upgrade, and they are just awesome.

    Here's a related SO question about Unity builds: #include all .cpp files into a single compilation unit?

提交回复
热议问题