This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Lilypond & GUILE: failure report, help!




Hi guys,

I've got some news from the LilyPond front.  I tried to assimilate
GUILE somewhat further into LilyPond, and I became quite disappointed
with GUILE's garbage collection system.  I am hoping to find out
whether I just made some stupid mistakes, or whether GUILEs GC is just
not good enough for me.

LilyPond contains two related classes called Molecule and Atom.  Atom
is a class that contains a SCM expression that (when evaluated) gives
a TeX string representing a musical notation symbol.  Additionally, it
contains an offset.  A Molecule is a collection (a linked list) of
Atoms.  Both Molecules and Atoms are created and destructed on a large
scale within the program: a page of printed music easily contains a
few thousand Atoms.  As an experiment, I transformed Atom into a smob,
and used a GUILE list in stead of a C++ list template to do the linked
list.

Processing a simple file that would normally take a 5 seconds or so,
takes several minutes with the smobbified version.  The program spends
a very long time in the output stage (where the SCM expressions are
evaluated and put out to a file).  I would estimate that the program
contains perhaps 100 to 1000 smobs and about the same number of
protected SCM objects during that stage.  Do minutes sound as
reasonable processing times?  I tried some tricks to keep down the
number of unprotect calls, to increase the heap size (allocating a
large block of memory), but to no avail.  Are there any other ways to
tune the collector?

I know I am being quite vague, so if anyone wants to help out, I can
prepare a version of LilyPond that uses smobs (I took them out again),
to give you an idea of what's happening.  You need python, GNU make
and egcs-c++-1.1 to compile LilyPond.

thanks in advance,

Han-Wen

BTW, What is the customary "null" value for SCM?  If I simply use 0, I
get core dumps from the garbage collector.


-- 

Han-Wen Nienhuys, hanwen@cs.uu.nl ** GNU LilyPond - The Music Typesetter 
      http://www.cs.uu.nl/people/hanwen/lilypond/index.html