What is this with the g++?
I am right now wrapping the fairly huge SndObj library written in C++ into an XS module. I'm done with maybe a third of all the classes and compilation is already painful:
ethan@ethan:~/Projects/dists/sound-object/Sound-Object$ time make
/usr/share/perl/5.8/ExtUtils/xsubpp -C++ -typemap /usr/share/perl/5.8/ExtUtils/typemap -typemap typemap Object.xs > Object.xsc && mv Object.xsc Object.c
g++ -c -I. -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC "-I/usr/lib/perl/5.8/CORE" -DOSS Object.c
rm -f blib/arch/auto/Sound/Object/Object.so
LD_RUN_PATH="" g++ -shared -L/usr/local/lib Object.o -o blib/arch/auto/Sound/Object/Object.so -lsndobj -lpthread
chmod 755 blib/arch/auto/Sound/Object/Object.so
One additional method added to the XS adds roughly one second of compilation time. Once in a while (mostly after rearranging the order of the packages in the XS file), compilation may take up to one minute. I am quite aware that what really slows down C++ compilation is the extensive use of templates. Now, SndObj uses next to no templates (and that includes no string objects, too). The XS stuff uses only one template worthy mentioning, a map of maps for the ref-counting of the Perl objects when a C++ object is constructed on behalf of another one.
Also, this slowness seems to be most significant with the g++. Microsoft's C++ compiler is by an order of quite a few magnitudes faster: It hardly ever needs more than 5 seconds for a far more complex WindowsForms