Boost logo

Boost Users :

Subject: Re: [Boost-users] Project using Boost.Units compiling slowly
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-12-24 22:23:18


On Thu, Dec 24, 2009 at 8:08 PM, Brandon Olivares
<programmer2188_at_[hidden]> wrote:
> Hi,
>
> I finally figured out how to use Boost.Units. But now it is compiling very
> slowly. It compiles in about 30 minutes on my local Windows machine using
> Cygwin, and in about 15 minutes on my remote CentOS server. There is very
> little code, but I am using a lot of units. Is there any way to speed it up?
>
> I don't know exactly how many units I'm using, because I have several macros
> for more easily defining them, but I know that there are many.
>
> Right now it is just a test program for testing out the units, but obviously
> I'll be expanding it soon and I'm worried that it is already taking so long
> to compile.

For note, templates are basically an entire programming language on
its own, but it was not originally conceived to be such a thing,
mostly an accident of the type system.

Now, since the fact it is a meta-language that came from the type
system, it is very slow in most compilers as they did not foresee a
need to create a fast type resolution system. GCC4 has been making
*great* strides to speed it up, and it is getting even better over
time. However, Visual Studio, even the latest versions, have not
really helped with compiling speed, they are more interested in
working on their .NET stuff then actually making a fast C++ compiler,
however, Visual Studio does often optimize template code better then
GCC (which will not actually matter for something as simple as the
Units sublibrary), but regardless, GCC is getting better, and Clang
should be yet even better later on

For some types of template code (like Spirit) there are ways to speed
things up by moving things across translation units, but with the
units sublibrary that is more difficult to do, not a lot you can do,
best suggestion is just try the newest compilers (especially with
GCC).


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net