Gerrit Voß wrote:
> Hi,
> 
> On Thu, 2009-07-02 at 16:55 +0200, Marcus Lindblom wrote: 

>> I was thinking about removing unnecessary #includes in .h files and 
>> reduce code in .inl. F.ex, the fcdcompile script #includes some files 
>> many times, both in the current class _and_ if the superclass has the 
>> same field types.
> 
> yes, the n-time include the same annoyed me too. With the superclass
> I'm not sure (automatically) as usually the fcd progs only see the
> current .fcd file, not the parent's one, so that maybe needs some
> hints in the fcd files.

Yup. Or a cache over all fcd's source file locations.

>> More pimpling or just fwd-declare and less inline might also help.
> 
> Hmm I would more tend to just forward declare and less inline. But that
> has a limit, in the container world a lot of includes come from the fact
> that the ptr fields need to have to access the container for the ref
> counting so you have to include the class declaration in case you inline
> the set/get methods, there are also some downcasts involved IIRC. As the
> big blocks of code come from templates rather that the container classes
> I'm not sure if you can completely get rid of them. I'll  have a look. 

Hm. We could also experiment with exporting templates across DLLs. I've 
had that working with MSVC8 and 9. It's a balancing act, but can be 
done. Wrap that with som #ifdef OSG_DLLIFY_TEMPLATE and it could be 
really interesting.

> Pimpl, I'm not sure we already have tons of classes and it adds another
> indirection. And changing the design for one platform is always
> something I'm not to happy about.

Righto.

>> However, the big win is probably pch support. I'll have to look at that.
> 
> Ok that would be great, I never worked with them, neither on windows nor
> on linux so I don't really have a good idea what they require.

Not much at all, but there are some traps that need avoiding.

You have a header that includes all major headers (pch.h), make a 
special cpp-file (pch.cpp) which includes that and creates your pch-file 
(f.ex. OSGBase.pch) due to some extra compiler flags for this file 
only). Then you include "pch.h" at the top of each .cpp in base and tell 
the compiler that pch.h is the precompiled header.

I've usually had one pch per DLL, but if you have different parts of the 
lib that uses different headers, there's no stopping you from having 
several pch files for each set of headers.

For dependent DLLs/exes, there are some options.
  * Simplest: include OSGBase's pch.h in their pch.h (how we do it)
  * Safest: make sure all OSGBase-headers still #include everything

Combining these would still speed up the build a bit. If one used 
external include guards (easy with fcdcompile, a hassle otherwise) it 
would be even faster.

The problem with the simple method is that if you are on a system that 
does not support pch:s, the compile time goes way up as you need to 
parse all pch-headers for each cpp.

Cheers,
/Marcus


------------------------------------------------------------------------------
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to