unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Guile + Boehm GC: First Remarks
@ 2006-05-31  8:49 Ludovic Courtès
  2006-05-31 20:11 ` Neil Jerram
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Ludovic Courtès @ 2006-05-31  8:49 UTC (permalink / raw)


Hello,

Some time ago, I started porting Guile to Boehm GC, mostly in order to
see whether this was feasible without loss of functionality and while
remaining as compatible as possible with the current Guile.

The good news is that I got to a "working", almost as feature-full, and
mostly-compatible, version of Guile that uses BGC.  Below are details
about the "almost" and "mostly" qualifiers, as well as pointers to the
code.  ;-)  Feedback is welcome!


* Memory Allocation

  In the current prototype, I changed the semantics of `scm_gc_malloc ()'
  so that it basically does a `GC_MALLOC ()'.  This means that the
  data returned by `scm_gc_malloc ()' will:

    1. be scanned for pointers (Scheme references);

    2. automatically be garbage-collected.

  I added a variant, `scm_gc_malloc_pointerless ()' which corresponds
  to `GC_MALLOC_ATOMIC ()', i.e., the returned memory area will
  automatically be garbage-collected but it will not be scanned for
  pointers.  This is useful, e.g., for stringbufs.

  This is different from the current semantics of `scm_gc_malloc ()'
  where it just "[i]nforms the GC that the memory [...] can
  potentially be freed during a GC".  However, it is (almost) a
  backward-compatible change: code that currently allocates memory
  using `scm_gc_malloc ()' is expected to free it explicitly with
  `scm_gc_free ()' and this will just work fine.

  Unfortunately, the combination
  `scm_gc_unregister_collectable_memory' + `free', which is supposed
  to work now, will no longer work.  Hopefully, this is a rare enough
  idiom and we can forget about it (?).

  These two `scm_gc_malloc' functions are very convenient since
  Guile-aware object implementations (e.g., SMOBs) can use them to
  allocate memory associated to the Scheme object and they no longer
  need to explicitly mark/free it (see below).

* Marking

  For SMOBs, use of a custom mark procedure is still supported, but
  should be useless in most cases: if `scm_gc_malloc ()' is used to
  allocate the memory associated to a SMOB, then this memory will
  automatically get marked and will be freed when needed.

* Finalization

  Guile basically offers three finalization mechanisms: guardians, the
  free procedure for SMOB types, and the free procedure for structs.
  All of them are implemented using libgc's finalizers, and they can
  coexist peacefully (e.g., a SMOB whose type defines a free procedure
  can also be guarded by one or more guardians).

  However, the implementation assumes that nobody besides guardians,
  SMOBs, and structs directly use libgc's finalizers (which is a
  reasonable assumption IMO).

* Weak Stuff

  Guile has two "weak" data types: weak hash tables and weak vectors.
  (Actually, it also has a third one, weak alist vectors, which is very
  similar to weak hash tables and thus should vanish --- that's the
  topic of another discussion)  Both of them are implemented using
  libgc's "disappearing links".

  More precisely, weak vectors are implemented as "regular vectors"
  with a specific memory allocation method.  Weak hash tables are
  implemented as non-weak vectors of weak alists.  A weak alist is
  defined as a list of weak pairs (weak-car pairs, weak-cdr pairs, or
  doubly-weak pairs).

  libgc's disappearing links work by setting weak pointers to NULL
  when the objects they point to becomes unreachable.  Because of
  this, an extra level of indirection had to be added for weak vectors
  and weak pairs: we need to make sure that user code never sees
  `PTR2SCM (NULL)'.  As a consequence, weak vectors can only be
  accessed via `scm_c_vector_ref ()' (I did not add the extra test to
  `SCM_SIMPLE_VECTOR_REF ()' so that regular vectors don't suffer from
  this), and weak hash tables can only be accessed via the authorized
  functions.

  Unfortunately, there are pieces of code in Guile that break this
  encapsulation.  In particular, `lookup_interned_symbol ()' does this,
  as well as `environments.c' (but we don't care about this one since
  it's unused).  I believe the best fix here would be to actually allow
  for read access to hash tables with no function-call overhead, e.g.,
  by exporting part of the API as inlines, and also by exporting a
  lower-level API (allowing for access to the raw buckets and bucket
  vectors).  Again, that's the topic for another discussion.  ;-)

* GC Hooks

  Only `before-gc-hook' and `after-gc-hook' (which are run before/after
  any `scm_i_gc ()' call) are honored.  The others just cannot be
  honored because they are too low-level.

* GC Stats

  I haven't thought much about this, but it looks is quite problematic.
  We probably can't provide the level of details of `gc-stats'.  And we
  cannot either provide per-object-type information as currently
  provided by `gc-live-object-stats' (this would require registering a
  finalizer for each and every object in order to update the object
  count).

  OTOH, per-object-type information, when needed, can be obtained by
  writing code that makes use of one of the finalization mechanism.  For
  instance, one can wrap a type constructor, or a class `initialize'
  method, so that every new instance is added to a guardian; then, said
  guardian can be periodically queried to update the instance counter.

* Static Initialization

  Using BGC allows for static initialization of Scheme objects (which
  the current GC does not permit), provided we can use GCC's `alignment'
  attribute or some equivalent pragma.  It's unclear whether
  statically-initializing a few strings and symbols here and there is
  likely to have a positive impact on startup time, but perhaps it's
  worth trying.


Conclusion: there are a few areas of incompatibility or feature loss
that can hardly be worked around (at first sight) and we'd have to
question whether this is a big issue.


I haven't done any serious performance measurement, but just to give an
idea, the test suite roughly takes as long to run with the current Guile
and with GBGC.  However, GBGC seems to be slightly slower when running
programs that allocate and discard lots of cells:

  $ time ../pre-inst-guile -c "(use-modules (srfi srfi-1)) (fold (lambda (x y) (list x)) '() (iota 300000)) (exit 0)"

  real    0m3.550s
  user    0m3.383s
  sys     0m0.162s

  $ time guile-1.8.0 -c "(use-modules (srfi srfi-1)) (fold (lambda (x y) (list x)) '() (iota 300000)) (exit 0)"

  real    0m2.738s
  user    0m2.650s
  sys     0m0.059s

One reason for this might be that GBGC adds one function call on the
allocation path while Guile's `scm_cell' currently rarely needs to call
a function.  This will need further benchmarking and investigation.


Although "usable", the code still needs more work.  I tested it only
with libgc 6.6 (from Debian sid) on GNU/Linux (sparc64, powerpc, i386 --
on sparc64, use GCC 4.1 instead of 4.0 since the latter seems to
generate invalid code at times).  It passes the test suite except for
`gc.test' which relies on `gc-live-object-stats' and `environments.test'
which I just renamed to `environments.nottest'.

You can get it from my Arch archive:

  $ tla register-archive http://www.laas.fr/~lcourtes/software/arch-2005
  $ tla get -A lcourtes@laas.fr--2005-libre guile-core--boehm-gc--1.9 \
        guile-core--bgc

A tarball and a diff against current CVS HEAD are also available:

  http://www.laas.fr/~lcourtes/software/arch-2005/guile-core/guile-core--boehm-gc/guile-core--boehm-gc--1.9/patch-35/guile-core--boehm-gc--1.9--patch-35.tar.gz
  http://www.laas.fr/~lcourtes/software/guile/guile-core--bgc--patch-35.diff.gz

SHA1 sums:

  6b6867dc637a24d7f9f25f99fb7d81c8a54b9190  guile-core--bgc--patch-35.diff.gz
  4a54c2489dbca7e5415be788c3d1fdc9884584f9  guile-core--boehm-gc--1.9--patch-35.tar.gz

That's it.

Sorry for the long mail and if you have any comment, don't hesitate!

Thanks,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-05-31  8:49 Guile + Boehm GC: First Remarks Ludovic Courtès
@ 2006-05-31 20:11 ` Neil Jerram
  2006-06-01  1:17   ` Han-Wen Nienhuys
  2006-06-01  7:55   ` Ludovic Courtès
  2006-06-01  1:10 ` Han-Wen Nienhuys
  2006-06-18 18:00 ` Clinton Ebadi
  2 siblings, 2 replies; 31+ messages in thread
From: Neil Jerram @ 2006-05-31 20:11 UTC (permalink / raw)


ludovic.courtes@laas.fr (Ludovic Courtès) writes:

> Sorry for the long mail and if you have any comment, don't hesitate!

Fascinating!  Assuming we can resolve the details you have listed,
what are the other high-level pros/cons, apart from performance?  Does
this mean we would discard all Guile's own GC code?  Also, is Boehm GC
as sophisticated as the generational GC ideas that people have talked
over the last year about adding Guile, or can we expect future Boehm
GC development to cover this?

Is Boehm GC an active project?  What else uses it?

Regards,
        Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-05-31  8:49 Guile + Boehm GC: First Remarks Ludovic Courtès
  2006-05-31 20:11 ` Neil Jerram
@ 2006-06-01  1:10 ` Han-Wen Nienhuys
  2006-06-01  8:09   ` Ludovic Courtès
  2006-06-18 18:00 ` Clinton Ebadi
  2 siblings, 1 reply; 31+ messages in thread
From: Han-Wen Nienhuys @ 2006-06-01  1:10 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2165 bytes --]

In article <877j42r32u.fsf@laas.fr>,
Ludovic Courtès <ludovic.courtes@laas.fr> wrote:
>* GC Stats
>
>  I haven't thought much about this, but it looks is quite problematic.
>  We probably can't provide the level of details of `gc-stats'.  And we
>  cannot either provide per-object-type information as currently
>  provided by `gc-live-object-stats' (this would require registering a
>  finalizer for each and every object in order to update the object
>  count).
>
>  OTOH, per-object-type information, when needed, can be obtained by
>  writing code that makes use of one of the finalization mechanism.  For
>  instance, one can wrap a type constructor, or a class `initialize'
>  method, so that every new instance is added to a guardian; then, said
>  guardian can be periodically queried to update the instance counter.


>I haven't done any serious performance measurement, but just to give an
>idea, the test suite roughly takes as long to run with the current Guile
>and with GBGC.  However, GBGC seems to be slightly slower when running
>programs that allocate and discard lots of cells:


Hi,

The per object GC stats are a hack of mine, and although I would be
sad to see it go (it makes debugging memory leaks easier), I think
getting BGC is worth it.  I don't see the point of the general GC
stats.  I think I've never ever used it.

Isn't it is possible to get other lowlevel statistics, or a list of
live objects from BGC?

>  $ time ../pre-inst-guile -c "(use-modules (srfi srfi-1)) (fold (lambda (x y) (list x)) '() (iota 300000)) (exit 0)"
>
>  real    0m3.550s
>  user    0m3.383s
>  sys     0m0.162s
>
>  $ time guile-1.8.0 -c "(use-modules (srfi srfi-1)) (fold (lambda (x y) (list x)) '() (iota 300000)) (exit 0)"
>
>  real    0m2.738s
>  user    0m2.650s
>  sys     0m0.059s

there is a more useful benchmark at

  http://www.xs4all.nl/~hanwen/public/software/GCBench.scheme

It's part of a suite by Hans Boehm of GC benchmarks, and I think you can
find more Scheme transliterations on the net.




_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-05-31 20:11 ` Neil Jerram
@ 2006-06-01  1:17   ` Han-Wen Nienhuys
  2006-06-01  7:22     ` Ludovic Courtès
  2006-06-02  0:01     ` Neil Jerram
  2006-06-01  7:55   ` Ludovic Courtès
  1 sibling, 2 replies; 31+ messages in thread
From: Han-Wen Nienhuys @ 2006-06-01  1:17 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]

In article <87irnmt0nk.fsf@ossau.uklinux.net>,
Neil Jerram  <neil@ossau.uklinux.net> wrote:
>ludovic.courtes@laas.fr (Ludovic Courtès) writes:
>
>> Sorry for the long mail and if you have any comment, don't hesitate!
>
>Fascinating!  Assuming we can resolve the details you have listed,
>what are the other high-level pros/cons, apart from performance?  Does
>this mean we would discard all Guile's own GC code?  Also, is Boehm GC
>as sophisticated as the generational GC ideas that people have talked
>over the last year about adding Guile, or can we expect future Boehm
>GC development to cover this?
>
>Is Boehm GC an active project?  What else uses it?

Boehm is generational, AFAIK.

Virtually everyone uses BGC. GCJ, MzScheme, BigLoog, GNU Obj-C, etc.

See,

http://www.hpl.hp.com/personal/Hans_Boehm/gc/

for a longer list.

By using BGC, you potentially loose a bit of performance, since BGC
isn't specialized for LISP/Scheme, but you get a system that is much
better overall researched and tuned.



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-01  1:17   ` Han-Wen Nienhuys
@ 2006-06-01  7:22     ` Ludovic Courtès
  2006-06-01  7:35       ` Mikael Djurfeldt
  2006-06-02  0:01     ` Neil Jerram
  1 sibling, 1 reply; 31+ messages in thread
From: Ludovic Courtès @ 2006-06-01  7:22 UTC (permalink / raw)
  Cc: guile-devel

Hi,

lilydev@muurbloem.xs4all.nl (Han-Wen Nienhuys) writes:

> Boehm is generational, AFAIK.
>
> Virtually everyone uses BGC. GCJ, MzScheme, BigLoog, GNU Obj-C, etc.

Yeah, and it's actively maintained and actively used.  The mailing list
is active as well and Hans Boehm has been very helpful answering my
questions.  Also, it's ported to a wide range of platforms, it's highly
tuned, it's designed to live with and take advantage of preemptive
multithreading, etc.  It's the result of a decade of design and
implementation work, as can be seen from
http://www.hpl.hp.com/personal/Hans_Boehm/gc/ .

I believe we would never have sufficient manpower to compete with it
(and it seems that most other language runtime implementors arrived to
the same conclusion).

Thanks,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-01  7:22     ` Ludovic Courtès
@ 2006-06-01  7:35       ` Mikael Djurfeldt
  2006-06-01  8:28         ` Ludovic Courtès
  2006-06-04 22:24         ` Han-Wen Nienhuys
  0 siblings, 2 replies; 31+ messages in thread
From: Mikael Djurfeldt @ 2006-06-01  7:35 UTC (permalink / raw)


On 6/1/06, Ludovic Courtès <ludovic.courtes@laas.fr> wrote:
> Yeah, and it's actively maintained and actively used.  The mailing list
> is active as well and Hans Boehm has been very helpful answering my
> questions.  Also, it's ported to a wide range of platforms, it's highly
> tuned, it's designed to live with and take advantage of preemptive
> multithreading, etc.  It's the result of a decade of design and
> implementation work, as can be seen from
> http://www.hpl.hp.com/personal/Hans_Boehm/gc/ .
>
> I believe we would never have sufficient manpower to compete with it
> (and it seems that most other language runtime implementors arrived to
> the same conclusion).

Yet, as long as the current GC is more efficient (as measured by
performance tests), there is no reason to switch, right?


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-05-31 20:11 ` Neil Jerram
  2006-06-01  1:17   ` Han-Wen Nienhuys
@ 2006-06-01  7:55   ` Ludovic Courtès
  2006-06-02  0:07     ` Neil Jerram
  1 sibling, 1 reply; 31+ messages in thread
From: Ludovic Courtès @ 2006-06-01  7:55 UTC (permalink / raw)
  Cc: Guile-Devel

Hi,

Neil Jerram <neil@ossau.uklinux.net> writes:

> Fascinating!  Assuming we can resolve the details you have listed,
> what are the other high-level pros/cons, apart from performance?  Does
> this mean we would discard all Guile's own GC code?  Also, is Boehm GC
> as sophisticated as the generational GC ideas that people have talked
> over the last year about adding Guile, or can we expect future Boehm
> GC development to cover this?

As Han-Wen said, BGC is generational.  More details are available from:

  http://www.hpl.hp.com/personal/Hans_Boehm/gc/gcdescr.html

For Guile, the main advantage is maintainability: using BGC
significantly reduces code complexity (i.e., it removes the
hardest-to-read parts of the code, it disentangles GC code from
functional code), it may improve portability, and it has the potential
to improve performance --- although that potential hasn't shown up yet.
;-)

>From a technical viewpoint, it is much, much easier to use, and avoids
many common programming errors: unless otherwise specified, every
register and every piece of memory is scanned for pointers, not only the
heap (however, only heap regions allocated via the GC allocation
routines are scanned).  Also, it periodically clears the unused part of
the stack, which may help avoid certain leaks (as the eval-stack leak
described in [0]).

Thanks,
Ludovic.

[0] http://lists.gnu.org/archive/html/guile-devel/2005-11/msg00047.html



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-01  1:10 ` Han-Wen Nienhuys
@ 2006-06-01  8:09   ` Ludovic Courtès
  0 siblings, 0 replies; 31+ messages in thread
From: Ludovic Courtès @ 2006-06-01  8:09 UTC (permalink / raw)
  Cc: guile-devel

Hi,

lilydev@muurbloem.xs4all.nl (Han-Wen Nienhuys) writes:

> The per object GC stats are a hack of mine, and although I would be
> sad to see it go (it makes debugging memory leaks easier), I think
> getting BGC is worth it.  I don't see the point of the general GC
> stats.  I think I've never ever used it.

Same for me: I find `gc-live-object-stats' more helpful than `gc-stats'.
But as I said, even if we no longer have it in-core, we should be able
to partially emulate it using guardians et al.

> Isn't it is possible to get other lowlevel statistics, or a list of
> live objects from BGC?

That doesn't seem to be the case, but I need to investigate it further.
Anyway, even if we can have such information, it will be lower-level
than `gc-stats', so not very useful I'm afraid.

> there is a more useful benchmark at
>
>   http://www.xs4all.nl/~hanwen/public/software/GCBench.scheme
>
> It's part of a suite by Hans Boehm of GC benchmarks, and I think you can
> find more Scheme transliterations on the net.

Thanks for the pointer!  I'll look into it.

Thanks,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-01  7:35       ` Mikael Djurfeldt
@ 2006-06-01  8:28         ` Ludovic Courtès
  2006-06-01  8:50           ` Mikael Djurfeldt
  2006-06-04 22:24         ` Han-Wen Nienhuys
  1 sibling, 1 reply; 31+ messages in thread
From: Ludovic Courtès @ 2006-06-01  8:28 UTC (permalink / raw)
  Cc: guile-devel

Hi,

"Mikael Djurfeldt" <mikael@djurfeldt.com> writes:

> Yet, as long as the current GC is more efficient (as measured by
> performance tests), there is no reason to switch, right?

Well, it's still unclear whether the current GC is more efficient, and
how much more if it is.  Furthermore, the GBGC code is a few weeks old
so it may be possible to tune it a bit more.

IMO, although I'm quite concerned with performance, I don't think it
should be the only criterion: maintainability and portability are
important as well.  The fact that Bigloo uses BGC also tends to reassure
me: if Guile can someday perform as bad as Bigloo compiled code (or
simply, as bad as its interpreter), then I'll be very happy.  ;-)

Thanks,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-01  8:28         ` Ludovic Courtès
@ 2006-06-01  8:50           ` Mikael Djurfeldt
  2006-06-01  9:42             ` Ludovic Courtès
  0 siblings, 1 reply; 31+ messages in thread
From: Mikael Djurfeldt @ 2006-06-01  8:50 UTC (permalink / raw)


On 6/1/06, Ludovic Courtès <ludovic.courtes@laas.fr> wrote:
> "Mikael Djurfeldt" <mikael@djurfeldt.com> writes:
>
> > Yet, as long as the current GC is more efficient (as measured by
> > performance tests), there is no reason to switch, right?
>
> Well, it's still unclear whether the current GC is more efficient, and
> how much more if it is.  Furthermore, the GBGC code is a few weeks old
> so it may be possible to tune it a bit more.
>
> IMO, although I'm quite concerned with performance, I don't think it
> should be the only criterion: maintainability and portability are
> important as well.

Certainly.  It's just that Guile has, to some extent, and with the
exception of a recent restructuring of the GC, had this tradition of
sacrificing performance for all kinds of "idealistic" goals with the
promise of increased future efficiency, getting more and more sluggish
all the time.  (It was quite efficient originally.)

If BGC holds the promise of efficiency, it might be nice to achieve
this before throwing out the current GC which is, btw, not
unreasonably unmaintainable or unportable.

The only point I would like to make is that it is silly to care too
much of the amount of thinking which has gone into BGC and its broad
usage if, in fact, it doesn't add anything of real value to Guile.

> The fact that Bigloo uses BGC also tends to reassure
> me: if Guile can someday perform as bad as Bigloo compiled code (or
> simply, as bad as its interpreter), then I'll be very happy.  ;-)

But current sluggishness is not mainly due to the current GC.  In
fact, for a scheme interpreter there might be advantages of using a
customized solution. One thing which would boost performance
tremendously would be to integrate Keisuke's guile-wm code, or
something a la QScheme.


In any case, I'm impressed with your achievement and appreciate the
extent of the work required.  And I think it would be just great if
this can be proven to be a road to better efficiency.  I hope so!


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-01  8:50           ` Mikael Djurfeldt
@ 2006-06-01  9:42             ` Ludovic Courtès
  2006-06-01 12:04               ` Ludovic Courtès
  0 siblings, 1 reply; 31+ messages in thread
From: Ludovic Courtès @ 2006-06-01  9:42 UTC (permalink / raw)
  Cc: guile-devel

Hi,

"Mikael Djurfeldt" <mikael@djurfeldt.com> writes:

> Certainly.  It's just that Guile has, to some extent, and with the
> exception of a recent restructuring of the GC, had this tradition of
> sacrificing performance for all kinds of "idealistic" goals with the
> promise of increased future efficiency, getting more and more sluggish
> all the time.  (It was quite efficient originally.)

I know, and that has been a real concern for me.

Interestingly, porting Guile to BGC has been one of these "idealistic"
goals for a number of years.  :-)

> If BGC holds the promise of efficiency, it might be nice to achieve
> this before throwing out the current GC which is, btw, not
> unreasonably unmaintainable or unportable.

Note: this is an _experiment_, whose purpose is precisely to get a
better understanding of the feasibility of the migration, of the gains
from a user perspective, and of the performance implications.
Personally, I'm inclined to move to GBGC, _if_ the performance overhead
is acceptable, that is, if the maintainability and robustness gains
overweight the performance cost.  But (i) this is only my personal
opinion, and (ii) I don't have serious performance results at this time.
This clearly needs to be evaluated before we can consider BGC as an
option.

Also, when discussing performance, one has to keep in mind that it is
very unlikely that anybody will ever improve the performance of Guile's
GC (I did try, had to gave, and got motivated by BGC ;-)).  On the
contrary, GBGC is constantly being improved, and performance seems to be
the main focus of Hans currently.

BTW, I did not mean to be insulting about the current GC, but a GC
written in C (be it Guile's or Boehm's) is _not_ something easily
maintainable.

> The only point I would like to make is that it is silly to care too
> much of the amount of thinking which has gone into BGC and its broad
> usage if, in fact, it doesn't add anything of real value to Guile.

My feeling is that it does add value, but we need to weight the pros and
cons.

>> The fact that Bigloo uses BGC also tends to reassure
>> me: if Guile can someday perform as bad as Bigloo compiled code (or
>> simply, as bad as its interpreter), then I'll be very happy.  ;-)
>
> But current sluggishness is not mainly due to the current GC.  In
> fact, for a scheme interpreter there might be advantages of using a
> customized solution. One thing which would boost performance
> tremendously would be to integrate Keisuke's guile-wm code, or
> something a la QScheme.

Exactly, that's the point I was trying to make.  If, for instance,
Bigloo's interpreter outperforms GBGC, then this means that there is
room for optimization in Guile's interpreter.  More generally, Guile-VM
(or some other form of compilation) is the way to go if we want to
noticeably improve performance.

Thanks,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-01  9:42             ` Ludovic Courtès
@ 2006-06-01 12:04               ` Ludovic Courtès
  0 siblings, 0 replies; 31+ messages in thread
From: Ludovic Courtès @ 2006-06-01 12:04 UTC (permalink / raw)
  Cc: guile-devel

ludovic.courtes@laas.fr (Ludovic Courtès) writes:

> Also, when discussing performance, one has to keep in mind that it is
> very unlikely that anybody will ever improve the performance of Guile's
> GC (I did try, had to gave, and got motivated by BGC ;-)).
                         ^^^^
This should read "had to give up".

Sorry,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-01  1:17   ` Han-Wen Nienhuys
  2006-06-01  7:22     ` Ludovic Courtès
@ 2006-06-02  0:01     ` Neil Jerram
  2006-06-02  8:06       ` Mikael Djurfeldt
  1 sibling, 1 reply; 31+ messages in thread
From: Neil Jerram @ 2006-06-02  0:01 UTC (permalink / raw)
  Cc: guile-devel

lilydev@muurbloem.xs4all.nl (Han-Wen Nienhuys) writes:

> Boehm is generational, AFAIK.
>
> Virtually everyone uses BGC. GCJ, MzScheme, BigLoog, GNU Obj-C, etc.
>
> See,
>
> http://www.hpl.hp.com/personal/Hans_Boehm/gc/
>
> for a longer list.

Thanks; lots of interesting stuff there.

> By using BGC, you potentially loose a bit of performance, since BGC
> isn't specialized for LISP/Scheme, but you get a system that is much
> better overall researched and tuned.

I like the "better research" and the maintainability angles, but I
don't see how we can say that BGC is "better tuned" than Guile's own
GC, if current data shows it performing less well.

Perhaps we aren't yet running a truly representative set of benchmarks
though?

Regards,
        Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-01  7:55   ` Ludovic Courtès
@ 2006-06-02  0:07     ` Neil Jerram
  2006-06-02 12:41       ` Ludovic Courtès
  0 siblings, 1 reply; 31+ messages in thread
From: Neil Jerram @ 2006-06-02  0:07 UTC (permalink / raw)


ludovic.courtes@laas.fr (Ludovic Courtès) writes:

> unless otherwise specified, every register and every piece of memory
> is scanned for pointers, not only the heap (however, only heap
> regions allocated via the GC allocation routines are scanned).

I wonder if this is the main cause of BGC not performing as well as
Guile's own GC?  Guile's own GC knows, for example, that there's no
point scanning the characters of a string, or the elements of a
uniform vector, and that SMOB memory looks after itself.  Does BGC
give us any way to feed this kind of information in, so that BGC could
avoid such scans in the same way Guile's GC does?

Regards,
        Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-02  0:01     ` Neil Jerram
@ 2006-06-02  8:06       ` Mikael Djurfeldt
  0 siblings, 0 replies; 31+ messages in thread
From: Mikael Djurfeldt @ 2006-06-02  8:06 UTC (permalink / raw)
  Cc: hanwen, guile-devel

On 6/2/06, Neil Jerram <neil@ossau.uklinux.net> wrote:
> Perhaps we aren't yet running a truly representative set of benchmarks
> though?

One should try to run some larger application with a large set of
slowly changing data structures, where the benefits of a generational
collector gets a chance to shine through.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-02  0:07     ` Neil Jerram
@ 2006-06-02 12:41       ` Ludovic Courtès
  2006-10-15  0:04         ` Han-Wen Nienhuys
  0 siblings, 1 reply; 31+ messages in thread
From: Ludovic Courtès @ 2006-06-02 12:41 UTC (permalink / raw)
  Cc: Guile-Devel

Hi,

Neil Jerram <neil@ossau.uklinux.net> writes:

> ludovic.courtes@laas.fr (Ludovic Courtès) writes:
>
>> unless otherwise specified, every register and every piece of memory
>> is scanned for pointers, not only the heap (however, only heap
>> regions allocated via the GC allocation routines are scanned).
>
> I wonder if this is the main cause of BGC not performing as well as
> Guile's own GC?

BGC ends up scanning more memory than Guile, of course.  However...

> Guile's own GC knows, for example, that there's no
> point scanning the characters of a string, or the elements of a
> uniform vector, and that SMOB memory looks after itself.  Does BGC
> give us any way to feed this kind of information in, so that BGC could
> avoid such scans in the same way Guile's GC does?

...  As explained in my original post, BGC provides a function to
allocate memory that must _not_ be scanned (namely `GC_MALLOC_ATOMIC').
In my post, I mentioned that I wrapped this feature in
`scm_gc_malloc_pointerless ()' so that one can use it, for instance, to
allocate stringbufs.

BGC also allows one to describe more complex "scanning" patterns.  For
instance, in order to implement weak-car pairs, one has to tell BGC to
not scan the first word of the pair (since otherwise the object pointed
to by the car would always remain unreachable).

But please, relax about performance, we still haven't run any meaningful
benchmark.  ;-)

Thanks,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-01  7:35       ` Mikael Djurfeldt
  2006-06-01  8:28         ` Ludovic Courtès
@ 2006-06-04 22:24         ` Han-Wen Nienhuys
  1 sibling, 0 replies; 31+ messages in thread
From: Han-Wen Nienhuys @ 2006-06-04 22:24 UTC (permalink / raw)


In article <66e540fe0606010035l7fb513fg646da4c1d94920de@mail.gmail.com>,
Mikael Djurfeldt <mikael@djurfeldt.com> wrote:
>> I believe we would never have sufficient manpower to compete with it
>> (and it seems that most other language runtime implementors arrived to
>> the same conclusion).
>
>Yet, as long as the current GC is more efficient (as measured by
>performance tests), there is no reason to switch, right?

There is a reason.

It is actually quite tricky to get the machinery of SMOB mark
functions to work exactly right in all cases. I have many late-night
debugging sessions that can attest to this. BGC will make it easier to
write GUILE extensions, because memory managements will be less of a
headache:

 - no need for mark() functions

 - no need for scm_remember_upto_here() calls

 - no more tricky interactions between half-finished SMOBs and GC mark
functions

 - no need for scm_gc_protect_object()






_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-05-31  8:49 Guile + Boehm GC: First Remarks Ludovic Courtès
  2006-05-31 20:11 ` Neil Jerram
  2006-06-01  1:10 ` Han-Wen Nienhuys
@ 2006-06-18 18:00 ` Clinton Ebadi
  2 siblings, 0 replies; 31+ messages in thread
From: Clinton Ebadi @ 2006-06-18 18:00 UTC (permalink / raw)
  Cc: Guile-Devel


[-- Attachment #1.1: Type: text/plain, Size: 1302 bytes --]

On Wed, 2006-05-31 at 10:49 +0200, Ludovic Courtès wrote:
> You can get it from my Arch archive:
> 
>   $ tla register-archive http://www.laas.fr/~lcourtes/software/arch-2005
>   $ tla get -A lcourtes@laas.fr--2005-libre guile-core--boehm-gc--1.9 \
>         guile-core--bgc
> 
> A tarball and a diff against current CVS HEAD are also available:
> 
>   http://www.laas.fr/~lcourtes/software/arch-2005/guile-core/guile-core--boehm-gc/guile-core--boehm-gc--1.9/patch-35/guile-core--boehm-gc--1.9--patch-35.tar.gz
>   http://www.laas.fr/~lcourtes/software/guile/guile-core--bgc--patch-35.diff.gz
> 
> SHA1 sums:
> 
>   6b6867dc637a24d7f9f25f99fb7d81c8a54b9190  guile-core--bgc--patch-35.diff.gz
>   4a54c2489dbca7e5415be788c3d1fdc9884584f9  guile-core--boehm-gc--1.9--patch-35.tar.gz
> 

Your patch touches a lot of files and reverts them to older versions.
Could you resync with cvs head, and send another patch with only the
real changes? If you don't have time I can do it.

Has anyone actually tried testing the performance of a real guile
program with the patch yet?
-- 
http://unknownlamer.org
Jabber: clinton@hcoop.net AIM:unknownlamer IRC:unknown_lamer@fnode#tpu
Real Men use Free Software; Open Source is for tools
443E 4F1A E213 7C54 A306  E328 7601 A1F0 F403 574B

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-06-02 12:41       ` Ludovic Courtès
@ 2006-10-15  0:04         ` Han-Wen Nienhuys
  2006-10-16  7:46           ` Ludovic Courtès
  0 siblings, 1 reply; 31+ messages in thread
From: Han-Wen Nienhuys @ 2006-10-15  0:04 UTC (permalink / raw)


Ludovic Courtès schreef:
> 
> But please, relax about performance, we still haven't run any meaningful
> benchmark.  ;-)

btw, is there any news on this patch?  I'm quite keen on dumping 
LilyPond's Rational class in favor of Scheme rationals, but adding gc 
mark functions for that is just too much work; BGC would be a nice 
soluiton to this.

-- 
  Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-15  0:04         ` Han-Wen Nienhuys
@ 2006-10-16  7:46           ` Ludovic Courtès
  2006-10-18 11:21             ` Han-Wen Nienhuys
                               ` (6 more replies)
  0 siblings, 7 replies; 31+ messages in thread
From: Ludovic Courtès @ 2006-10-16  7:46 UTC (permalink / raw)
  Cc: guile-devel

Hi Han-Wen,

Han-Wen Nienhuys <hanwen@xs4all.nl> writes:

> Ludovic Courtès schreef:
>>
>> But please, relax about performance, we still haven't run any meaningful
>> benchmark.  ;-)
>
> btw, is there any news on this patch?  I'm quite keen on dumping
> LilyPond's Rational class in favor of Scheme rationals, but adding gc
> mark functions for that is just too much work; BGC would be a nice
> soluiton to this.

Well, no real news.  My "not-so-meaningful benchmarks" (running a
loop[*]) reproductively show that "GBGC" is noticeably slower than "real
Guile" (1.5 to 2 times slower).

This could be due to various reasons.

* It could be that too much memory is being retained and subsequently
  scanned.  That's what I initially thought but after looking for this
  kind of error for some time, I'm not so convinced that this is the
  case.

* Initially, a fair amount of pointer-less memory (e.g., file or string
  contents) ended up being scanned.  I fixed this at some point, and now
  I don't think there's any such error left.

* The GC settings should be tweaked.  For instance, increasing BGC's
  initial heap size (e.g., via the `GC_INITIAL_HEAP_SIZE' environment
  variable) yields a noticeable improvement (though not sufficient).

* Any other reason listed (or not listed ;-)) at
  http://www.hpl.hp.com/personal/Hans_Boehm/gc/debugging.html .


At this point, I'm a bit clueless not (yet) completely hopeless.  ;-)
That is, I think it'd be worth keeping investigating this, but I'm
definitely looking for people with a fresh view on the topic to help!
:-)

I recently merged in changes from HEAD in my BGC branch.  If you want to
give it a try and if you want to help, you can fetch it this way:

  $ tla register-archive http://www.laas.fr/~lcourtes/software/arch-2005/
  $ tla get lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9

Thanks,
Ludovic.


[*] It turns out that even tail-recursive call trigger memory
    allocation, via `SCM_EXTEND_ENV ()'.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-16  7:46           ` Ludovic Courtès
@ 2006-10-18 11:21             ` Han-Wen Nienhuys
  2006-10-19 14:25               ` Ludovic Courtès
  2006-10-18 11:34             ` Han-Wen Nienhuys
                               ` (5 subsequent siblings)
  6 siblings, 1 reply; 31+ messages in thread
From: Han-Wen Nienhuys @ 2006-10-18 11:21 UTC (permalink / raw)


Ludovic Courtès schreef:
> I recently merged in changes from HEAD in my BGC branch.  If you want to
> give it a try and if you want to help, you can fetch it this way:
> 
>   $ tla register-archive http://www.laas.fr/~lcourtes/software/arch-2005/
>   $ tla get lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9

Just a note: autogen.sh barfs while trying to generate BUGS.
apparently

  ../guile-scripts

doesn't live where it is assumed to live.

-- 
  Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-16  7:46           ` Ludovic Courtès
  2006-10-18 11:21             ` Han-Wen Nienhuys
@ 2006-10-18 11:34             ` Han-Wen Nienhuys
  2006-10-19 14:28               ` Ludovic Courtès
  2006-10-18 14:42             ` Han-Wen Nienhuys
                               ` (4 subsequent siblings)
  6 siblings, 1 reply; 31+ messages in thread
From: Han-Wen Nienhuys @ 2006-10-18 11:34 UTC (permalink / raw)


Ludovic Courtès schreef:
>   $ tla register-archive http://www.laas.fr/~lcourtes/software/arch-2005/
>   $ tla get lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9

  gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -g -O2 -Wall 
-Wmissing-prototypes -Werror -MT libguile_la-gc.lo -MD -MP -MF 
.deps/libguile_la-gc.Tpo -c gc.c  -fPIC -DPIC -o .libs/libguile_la-gc.o
cc1: warnings being treated as errors
gc.c:230: warning: 't_before_gc' defined but not used
make[2]: *** [libguile_la-gc.lo] Error 1


-- 
  Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-16  7:46           ` Ludovic Courtès
  2006-10-18 11:21             ` Han-Wen Nienhuys
  2006-10-18 11:34             ` Han-Wen Nienhuys
@ 2006-10-18 14:42             ` Han-Wen Nienhuys
  2006-11-26 18:48               ` Ludovic Courtès
  2006-10-18 14:59             ` Han-Wen Nienhuys
                               ` (3 subsequent siblings)
  6 siblings, 1 reply; 31+ messages in thread
From: Han-Wen Nienhuys @ 2006-10-18 14:42 UTC (permalink / raw)


Ludovic Courtès schreef:
>>> But please, relax about performance, we still haven't run any meaningful
>>> benchmark.  ;-)
>> btw, is there any news on this patch?  I'm quite keen on dumping
>> LilyPond's Rational class in favor of Scheme rationals, but adding gc
>> mark functions for that is just too much work; BGC would be a nice
>> soluiton to this.
> 
> Well, no real news.  My "not-so-meaningful benchmarks" (running a
> loop[*]) reproductively show that "GBGC" is noticeably slower than "real
> Guile" (1.5 to 2 times slower).

I've patched it a bit to use GC_typed alloc for tagged data. It probably 
doesn't make much of a difference, since 90% of the data is regular 
cells, but see http://www.xs4all.nl/~hanwen/public/software/guile-bgc.patch

With the tree benchmark (included in patch, I get 54 secs (Guile 1.8) 
vs. 1:25 (typed BGC). I forgot to measure regular BGC, though.

Note that BGC has ALL_INTERIOR_POINTERS switched on by default 
nowadays, which means that it may scan too much. You could try switching 
that off.

-- 
  Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-16  7:46           ` Ludovic Courtès
                               ` (2 preceding siblings ...)
  2006-10-18 14:42             ` Han-Wen Nienhuys
@ 2006-10-18 14:59             ` Han-Wen Nienhuys
  2006-10-18 15:42             ` Han-Wen Nienhuys
                               ` (2 subsequent siblings)
  6 siblings, 0 replies; 31+ messages in thread
From: Han-Wen Nienhuys @ 2006-10-18 14:59 UTC (permalink / raw)


Ludovic Courtès schreef:
>>> But please, relax about performance, we still haven't run any meaningful
>>> benchmark.  ;-)
>> btw, is there any news on this patch?  I'm quite keen on dumping
>> LilyPond's Rational class in favor of Scheme rationals, but adding gc
>> mark functions for that is just too much work; BGC would be a nice
>> soluiton to this.
> 
> Well, no real news.  My "not-so-meaningful benchmarks" (running a
> loop[*]) reproductively show that "GBGC" is noticeably slower than "real
> Guile" (1.5 to 2 times slower).

tuning down GC_free_space_divisor to 2 sped things up a little bit, 
around 10 %. I'm now at 77sec (vs GUILE 1.8: 52 sec)

I'm on dual-core nowadays, so real time it's actually still a bit 
faster, as BGC is multithreaded.


-- 
  Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-16  7:46           ` Ludovic Courtès
                               ` (3 preceding siblings ...)
  2006-10-18 14:59             ` Han-Wen Nienhuys
@ 2006-10-18 15:42             ` Han-Wen Nienhuys
  2006-10-18 16:10             ` Han-Wen Nienhuys
  2006-10-18 16:53             ` Han-Wen Nienhuys
  6 siblings, 0 replies; 31+ messages in thread
From: Han-Wen Nienhuys @ 2006-10-18 15:42 UTC (permalink / raw)


Ludovic Courtès schreef:
> Hi Han-Wen,
> 
> Han-Wen Nienhuys <hanwen@xs4all.nl> writes:
> 
>> Ludovic Courtès schreef:
>>> But please, relax about performance, we still haven't run any meaningful
>>> benchmark.  ;-)
>> btw, is there any news on this patch?  I'm quite keen on dumping
>> LilyPond's Rational class in favor of Scheme rationals, but adding gc
>> mark functions for that is just too much work; BGC would be a nice
>> soluiton to this.
> 
> Well, no real news.  My "not-so-meaningful benchmarks" (running a
> loop[*]) reproductively show that "GBGC" is noticeably slower than "real
> Guile" (1.5 to 2 times slower).

On larger samples the difference gets smaller.
With a 128mb footprint (GC tree benchmark), the difference is that BGC 
is just 23% slower,


-- 
  Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-16  7:46           ` Ludovic Courtès
                               ` (4 preceding siblings ...)
  2006-10-18 15:42             ` Han-Wen Nienhuys
@ 2006-10-18 16:10             ` Han-Wen Nienhuys
  2006-10-18 16:53             ` Han-Wen Nienhuys
  6 siblings, 0 replies; 31+ messages in thread
From: Han-Wen Nienhuys @ 2006-10-18 16:10 UTC (permalink / raw)


Ludovic Courtès schreef:
> Well, no real news.  My "not-so-meaningful benchmarks" (running a
> loop[*]) reproductively show that "GBGC" is noticeably slower than "real
> Guile" (1.5 to 2 times slower).

the following options turn on generational GC

   GC_enable_incremental ();
   GC_time_limit = GC_TIME_UNLIMITED;

with this, I get (very) slight performance improvement. For the 32mb 
tree test, BGC is 40% slower, for the 128mb tree, it's 31%

(disregard the previous figure of 23 %, it was an error in calculation, 
it should have been 33 %)

-- 
  Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-16  7:46           ` Ludovic Courtès
                               ` (5 preceding siblings ...)
  2006-10-18 16:10             ` Han-Wen Nienhuys
@ 2006-10-18 16:53             ` Han-Wen Nienhuys
  6 siblings, 0 replies; 31+ messages in thread
From: Han-Wen Nienhuys @ 2006-10-18 16:53 UTC (permalink / raw)


Ludovic Courtès schreef:
> Well, no real news.  My "not-so-meaningful benchmarks" (running a
> loop[*]) reproductively show that "GBGC" is noticeably slower than "real
> Guile" (1.5 to 2 times slower).

with some final tweaks I got it to 26% (large test) and 32% (small test) 
slower.

-- 
  Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-18 11:21             ` Han-Wen Nienhuys
@ 2006-10-19 14:25               ` Ludovic Courtès
  2006-10-25 18:47                 ` Neil Jerram
  0 siblings, 1 reply; 31+ messages in thread
From: Ludovic Courtès @ 2006-10-19 14:25 UTC (permalink / raw)
  Cc: guile-devel

Hi Han-Wen,

Han-Wen Nienhuys <hanwen@xs4all.nl> writes:

> Just a note: autogen.sh barfs while trying to generate BUGS.
> apparently
>
>  ../guile-scripts
>
> doesn't live where it is assumed to live.

Yes, `autogen.sh' makes a lot of assumptions about what your file system
should contain.  Personally, I no longer use it: I use the more reliable
(and less intrusive) `autoreconf -i'.

I think we should either remove that script or simply have it contain
that `autoreconf' invocation.

Thanks,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-18 11:34             ` Han-Wen Nienhuys
@ 2006-10-19 14:28               ` Ludovic Courtès
  0 siblings, 0 replies; 31+ messages in thread
From: Ludovic Courtès @ 2006-10-19 14:28 UTC (permalink / raw)
  Cc: guile-devel

Hi,

Han-Wen Nienhuys <hanwen@xs4all.nl> writes:

> Ludovic Courtès schreef:
>>   $ tla register-archive http://www.laas.fr/~lcourtes/software/arch-2005/
>>   $ tla get lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9
>
>  gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -g -O2 -Wall
> -Wmissing-prototypes -Werror -MT libguile_la-gc.lo -MD -MP -MF
> .deps/libguile_la-gc.Tpo -c gc.c  -fPIC -DPIC -o .libs/libguile_la-gc.o
> cc1: warnings being treated as errors
> gc.c:230: warning: 't_before_gc' defined but not used
> make[2]: *** [libguile_la-gc.lo] Error 1

Yeah, thanks.  `-Werror' is too harsh.  ;-)

Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-19 14:25               ` Ludovic Courtès
@ 2006-10-25 18:47                 ` Neil Jerram
  0 siblings, 0 replies; 31+ messages in thread
From: Neil Jerram @ 2006-10-25 18:47 UTC (permalink / raw)
  Cc: guile-devel

ludovic.courtes@laas.fr (Ludovic Courtès) writes:

> Yes, `autogen.sh' makes a lot of assumptions about what your file system
> should contain.  Personally, I no longer use it: I use the more reliable
> (and less intrusive) `autoreconf -i'.
>
> I think we should either remove that script or simply have it contain
> that `autoreconf' invocation.

Perhaps, but we'd need more discussion of the other things that the
script does first.  Given that you can choose just to use autoreconf
if you want to, I don't think the discussion's worth it right now.

Regards,
     Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Guile + Boehm GC: First Remarks
  2006-10-18 14:42             ` Han-Wen Nienhuys
@ 2006-11-26 18:48               ` Ludovic Courtès
  0 siblings, 0 replies; 31+ messages in thread
From: Ludovic Courtès @ 2006-11-26 18:48 UTC (permalink / raw)


Hi,

I'm finally getting back to this (sorry for the delay!).

Han-Wen Nienhuys <hanwen@xs4all.nl> writes:

> I've patched it a bit to use GC_typed alloc for tagged data. It
> probably doesn't make much of a difference, since 90% of the data is
> regular cells, but see
> http://www.xs4all.nl/~hanwen/public/software/guile-bgc.patch
>
> With the tree benchmark (included in patch, I get 54 secs (Guile 1.8)
> vs. 1:25 (typed BGC). I forgot to measure regular BGC, though.

Thanks for the patch.  I tried it out but it doesn't apparently yield
any performance improvement (see below).

> Note that BGC has ALL_INTERIOR_POINTERS switched on by default
> nowadays, which means that it may scan too much. You could try
> switching that off.

Good idea.  I tried this (patch available in my Arch branch) and it does
indeed yield a slight improvement.  Here's the summary of the various
performance measurements, each time running the whole `gcbench.scm' that
you provided:

  * Guile 1.8					52 sec. (+0%)

  * GBGC w/ tagged allocs			1"27 (+40%)

  * GBGC w/o tagged allocs			1"18 (+33%)

  * GBGC + no interior pointers			1"13 (+29%)

  * GBGC + no interior ptrs + `GC_expand_hp'	1"13 (+29%)

In the last case, `GC_expand_hp ()' is systematically used to increase
the initial heap size at startup time; this may have a positive impact
on short-lived programs, but doesn't have any impact here,
understandably.

I guess we need other bright ideas.  ;-)

Thanks,
Ludovic.



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2006-11-26 18:48 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-31  8:49 Guile + Boehm GC: First Remarks Ludovic Courtès
2006-05-31 20:11 ` Neil Jerram
2006-06-01  1:17   ` Han-Wen Nienhuys
2006-06-01  7:22     ` Ludovic Courtès
2006-06-01  7:35       ` Mikael Djurfeldt
2006-06-01  8:28         ` Ludovic Courtès
2006-06-01  8:50           ` Mikael Djurfeldt
2006-06-01  9:42             ` Ludovic Courtès
2006-06-01 12:04               ` Ludovic Courtès
2006-06-04 22:24         ` Han-Wen Nienhuys
2006-06-02  0:01     ` Neil Jerram
2006-06-02  8:06       ` Mikael Djurfeldt
2006-06-01  7:55   ` Ludovic Courtès
2006-06-02  0:07     ` Neil Jerram
2006-06-02 12:41       ` Ludovic Courtès
2006-10-15  0:04         ` Han-Wen Nienhuys
2006-10-16  7:46           ` Ludovic Courtès
2006-10-18 11:21             ` Han-Wen Nienhuys
2006-10-19 14:25               ` Ludovic Courtès
2006-10-25 18:47                 ` Neil Jerram
2006-10-18 11:34             ` Han-Wen Nienhuys
2006-10-19 14:28               ` Ludovic Courtès
2006-10-18 14:42             ` Han-Wen Nienhuys
2006-11-26 18:48               ` Ludovic Courtès
2006-10-18 14:59             ` Han-Wen Nienhuys
2006-10-18 15:42             ` Han-Wen Nienhuys
2006-10-18 16:10             ` Han-Wen Nienhuys
2006-10-18 16:53             ` Han-Wen Nienhuys
2006-06-01  1:10 ` Han-Wen Nienhuys
2006-06-01  8:09   ` Ludovic Courtès
2006-06-18 18:00 ` Clinton Ebadi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).