Build All Boost in Minutes

Can someone explain why the following instructions:

http://www.boost.org/doc/libs/1_59_0/more/getting_started/unix-variants.html#easy-build-and-install

... it takes 5 hours to create the whole Boost, and some people report the same in just 3 minutes?

Is there any other way to create a Boost than the one mentioned above, which really goes pretty fast (compared to a few hours, anyway).

I am using the Clang compiler on Darwin (Mac). Not sure how appropriate this is, but I have 16 GB of RAM and a recent SSD. The clock is 2.3 GHz.

Edit: I am pleased to inform, based on comments and answers, that using the ./b2 -j4 -d0 I got a compilation time of up to 13 minutes. In addition, the -jN parameter -jN not listed in the list of available options by default --help , you should instead call --help-options to see these additional more "advanced" methods.

+5
source share
3 answers

I just ran a few tests with several different build configurations.

Hardware: 2012 MacBook Pro (2.3Ghz Ivy Bridge i7 [i7-3615QM]), factory SSD and 16 GB of RAM.

Software: Mac OS X 10.11.1 with Xcode 7 (Apple LLVM version 7.0.0 clang-700.1.76). Fresh copy of Boost 1.59.0 from the website.

I tested the following build commands:

Default:

./bootstrap.sh && ./b2 -j N

Building forced binding of lib ++

./bootstrap.sh && ./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" -j N

For each, I tried three different values โ€‹โ€‹for N: 1 (one thread), 4 (corresponding physical cores) and 8 (matching hyper-thread cores).

Default Link:

  • From 8, the build time was 6:45 minutes.
  • With 4 build times, it was 7:22 minutes.
  • From 1 build time was 22:58 minutes.

Binding libC ++:

  • From 8, the build time was 4:35 minutes.
  • With 4, the build time was 5:45 minutes.
  • From 1 build time was 17:15 minutes.

Conclusion: Boost should not spend all day building a multi-core system with SSDs, even if it is not new. Building using the standard (dedicated stream) takes longer than parallel assembly. Boost build with clang on OS X benefits a bit from hyperthreading. Linking to libC ++ seems even faster.

+8
source

I assume that you are not using the -jN parallel assembly option (where N is the number of processes, maybe a little more than the number of cores on your computer). Also, 3 minutes sounds like a single configuration on a machine with an sdd or ram drive, and 5 hours, like the entire configuration with one process and a slow hard drive.

+5
source

Most boost packages are header-only. If you only need those, the installation simply copies the files. Based on how many compiled packages you make, the time can differ by several orders of magnitude. Plus yes, parallel compilation, different machine (Raspberry Pi vs 32 IvyBridge Blade CPU), etc. Plus, building from and into /dev/shm can give you significant speedup.

0
source

Source: https://habr.com/ru/post/1235364/


All Articles