How to reduce compilation times with Boost Asio

前端 未结 4 471
南旧
南旧 2021-01-14 09:14

Boost.Asio is great library but it has one huge drawback -- extreamly slow compilation times. A simple implementation (really simple) of HTTP protocol (about 1k lines of cod

4条回答
  •  温柔的废话
    2021-01-14 10:14

    • Do you use boost::lambda or boost::bind to construct your completion handlers? boost::bind is less complex => compiles faster.
    • You can profile the compiler with #pragma message() to see if it's the #include-ing or the actual compiling that takes time. I've used this with MSVS to see that sometimes, most of the compilation time is before any code in the .cpp, and other times, it's mostly after. That could help you to profile your compiler's performance. (But, if the preprocessor/#include is fast and run before anything else, it won't give you much)

提交回复
热议问题