So I began to investigate and found out each invocation of known Boost
constructs has its non-zero cost. I chose a source file(*), commented
out all and then incrementally uncommented functions from beginning,
compiled and measured times. Here is my results (compile time, not run
time!):
- BOOST_FOREACH costs 0.1 sec
- boost::function<> invocation costs 0.05 sec
- boost::lambda::bind() with placeholders costs 0.1 sec
- Boost.Range adaptor transformed() costs ~0.1 too
As you can see, 10 boost::lambda::bind() slow down your compilation for
whole 1 second!
All that is measured against gcc 4.4, Ubuntu 9.10, with the most light
options I picked up: "g++ -g -O0 -pipe" (I need -g for debugging
anyway). Also I found out that gcc 4.2 is the quickest from 4.1, 4.2,
4.3, 4.4 version of gcc, and gcc 4.4 is the most slow one of them (~28%
slower than gcc 4.2). :(