Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ethan (3163)

ethan ...

Being a 25-year old chap living in the western-most town of Germany. Stuying communication and information science and being a huge fan of XS-related things.

Journal of ethan (3163)

Tuesday March 15, 2005
03:24 AM

Increasing turn-around times

[ #23657 ]

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/bin/perl /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/
LD_RUN_PATH="" g++  -shared -L/usr/local/lib Object.o  -o blib/arch/auto/Sound/Object/   -lsndobj -lpthread
chmod 755 blib/arch/auto/Sound/Object/
real    0m38.023s
user    0m31.130s
sys     0m0.570s

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 .NET application which uses templates all over the place. This might be due to the use of precompiled headers.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.