1.

How To Reduce Compilation Time Of Programs Using Cgal?

Answer»

CGAL is heavily USING C++ templates, and this has an impact on compilation speed.

Here are some hints that can help speed up compilation of programs using CGAL:

  • Remove compiler debugging options like -g if you can. Indeed, generating debug information can be very costly for template instantiations, both in TERMS of RUNNING TIME and memory usage by the compiler tool chain.
  • Remove compiler optimization options like -O2 when you do not need them, such as in the early steps of the development cycle of your programs.

Regroup translation units: If your program is composed of many small translation units to be COMPILED and linked, try to reduce their numbers by merging them. This traditional style for C programs is actually very slow for programs heavily using C++ templates. Regrouping them reduces the time spent by the compiler to parse the header files, and avoids redundant template instantiations.

Precompiled header files: Some compilers, such as GCC, provide a feature named precompiled headers. This can be mostly useful if you can regroup in a single header file most of the header files that you use, together with most template instantiations.

CGAL is heavily using C++ templates, and this has an impact on compilation speed.

Here are some hints that can help speed up compilation of programs using CGAL:

Regroup translation units: If your program is composed of many small translation units to be compiled and linked, try to reduce their numbers by merging them. This traditional style for C programs is actually very slow for programs heavily using C++ templates. Regrouping them reduces the time spent by the compiler to parse the header files, and avoids redundant template instantiations.

Precompiled header files: Some compilers, such as GCC, provide a feature named precompiled headers. This can be mostly useful if you can regroup in a single header file most of the header files that you use, together with most template instantiations.



Discussion

No Comment Found