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]

Re: Lilypond, GUILE and Garbage Collection (again)


On Thu, 8 Apr 1999, Han-Wen Nienhuys wrote:

> ANALYSIS:
> 
> scm_[un]protect_object uses a linear list, with O(1) insertion and
> O(n) deletion performance.  After these 100,000 objects are created,
> we delete them in order of creation; this causes O(n^2) behavior on
> the whole, which gets noticeable when n = 100,000.
[...]
> 2. Writing a better scm_[un]protect_object
[...]
> 1.  Would an improved version of scm_[un]protect_object be useful?  Is
> there any interest in my code?

This is probably better done by using hash tables.  Some time ago, Jay
Glascoe has put considerable effort into implementing very effective auto
resizing hash tables for guile.  You might try to use them rather than
balanced trees.  http://www.giss.nasa.gov/~jglascoe/GUILE/

> 3. Using SMOBs to mark the alists using C++ code.

This is probably also a very good solution, but I don't know how this fits
into Greg Harveys approach to improve and generalize guile's garbage
collection.  

It also reminds me of an old idea I once presented to the list:  Having to
define some SMOB just in order to get the garbage collection right still
seems strange to me.  You probably define the SMOB, create one
single object of it that is put into the scm_protect list and that is all 
you need that SMOB for. Instead, the garbage collector could have a set of
functions that are called during garbage collection time and that report
cells which are still in use to the collector.  For your case this would
mean that you would not have to create a SMOB for marking, but you rather
would (at program start) report the mark function to the garbage
collector.  -- Greg: Would it be possible / make sense to combine such an
approach with your garbage collector?


BTW:  Han-Wen, some time ago I took a look at the lilypond web pages.  I
realized that guile is required for building lilypond, but I couldn't find
any information about the way you make use of guile.  Is it possible to
create music pieces via guile scripts?  Do you want to change the input
language to use a more schemey syntax?

Best regards,
Dirk Herrmann