Subject: CGAL users discussion list
List archive
- From: "Fernando Cacciola" <>
- To: <>
- Subject: Re: [cgal-discuss] reducing compile time
- Date: Mon, 19 Nov 2007 09:23:54 -0300
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:from:to:references:in-reply-to:subject:date:organization:mime-version:content-type:content-transfer-encoding:x-priority:x-msmail-priority:x-mailer:x-mimeole; b=BKK1lpcJgMC5sEYfSpX57zoLQsLMTVRkUVW2bD4KLALuiMkjLmF4VoEuhISnEUhUoRxoOsOizQ2bdZc8T4Sl+Zv7HIRkQzrVeXN03Y8c96flFEA/2469mkPz4ha447zWxtjF5BZ9hJ2H7H4hBni06rFDM/9fJO5gxerNdCxzZWg=
- Organization: SciSoft
Hello Gabriel,
Hello,In the very old days when I used Borland C++ you could instruct the compiler to cache template instantiations, provided you force a shared instantiation by defining in a global header a full instantiation.
is there any tip or trick to reduce the compile time of a CGAL application?
I am using an enriched polyhedron template with a bunch of templated (since
they use the enriched polyhedron) functionalities, and it often takes
several minutes to compile since every single header/template is recompiled
each time. Is there a technique to minimize template recompilation?
It was many years ago but IIRC the trick was to do something like this:
extern CGAL::Polyhedron_3<..whatever...> p ;
It was very important to actually define a variable of the instantiated template type and not just declare an alias to it via typedef, to force the compiler to actually do the instantiation.
Since the variable is extern there is no ODR, so you can put it in any header, and since it has external linkage (it is visible across translation units) the compiler will cache the template instantiation if it is smart enough.
I seem to recall that we needed to have a source file containing the actual definition to avoid a linker error, but I'm not sure that should be needed if you never reference the variable (maybe I'm recalling wrong and using 'extern' didn't do the trick, with using 'static' did).
HTH
Fernando Cacciola
- reducing compile time, Gabriel Cirio, 11/19/2007
- Re: [cgal-discuss] reducing compile time, Fernando Cacciola, 11/19/2007
- Re: [cgal-discuss] reducing compile time, Sylvain Pion, 11/22/2007
Archive powered by MHonArc 2.6.16.