Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Using AFIO really slows down my compile times. Can't you do something about that?

You'll find a huge amount depends on your compiler. Here are some build time benchmarks for my developer workstation:

Table 1.17. Single thread build times for AFIO v1.3 for various compilers and options on a 3.5Ghz Intel Core i7 3770K

Build flags

Microsoft Windows 8.1 x64 with Visual Studio 2013

Ubuntu 14.04 LTS Linux x64 with GCC 4.9 and gold linker

Ubuntu 14.04 LTS Linux x64 with clang 3.4 and gold linker

--link-test --fast-build debug

0m55s

3m53s

asio failure

--link-test debug

2m10s

10m26s

5m46s

--link-test --lto debug

5m37s

GCC ICE

5m42s

--link-test pch=off debug

7m17s

12m0s

5m45s

--link-test --fast-build release

1m10s

3m22s

asio failure

--link-test release

2m58s

9m57s

8m10s

--link-test --lto release

7m30s

13m0s

8m11s

standalone alltests release

0m20s

0m51s

0m42s

standalone multiabi alltests release

0m39s

1m34s

1m13s


Table 1.18. Single thread build times for AFIO v1.2 for various compilers and options on a 3.5Ghz Intel Core i7 3770K

Build flags

Microsoft Windows 8 x64 with Visual Studio 2013

Ubuntu 12.04 LTS Linux x64 with GCC 4.8 and gold linker

Ubuntu 12.04 LTS Linux x64 with clang 3.4 and gold linker

--link-test --fast-build debug

01m43s

03m31s[a]

fails

--link-test debug

02m40s

06m15s

04m24s

--link-test --lto debug

09m36s

06m23s

04m32s

--link-test pch=off debug

06m12s

08m01s

04m26s

--link-test --fast-build release

02m01s

03m15s[b]

fails

--link-test release

03m09s

06m28s

06m06s

--link-test --lto release

10m24s

07m08s

06m14s

[a] ASIO has a link error without link=static

[b] ASIO has a link error without link=static


You'll note that v1.3 is substantially faster than v1.2 to build on MSVC for some odd reason, despite considerably more metaprogramming, code, and tests. The rises in times like with GCC and clang make more sense.

The benefit of --fast-build grows exponentially the less powerful the CPU: on my Intel Atom 220 netbook --fast-build gets total build times under five minutes which is impressive compared to the twenty or so minutes without that flag.

--fast-build works by defining BOOST_AFIO_HEADERS_ONLY to 0 for each compiland, and linking to the AFIO shared library instead. It also does the same for ASIO by defining BOOST_ASIO_SEPARATE_COMPILATION and BOOST_ASIO_DYN_LINK for each compiland, and links to the ASIO shared library instead (which is built via boost/asio/impl/src.hpp, see ASIO's docs).


PrevUpHomeNext