GUILE2: softcode GC environment tuning (issue 563500045 by hanwenn@gmail.com)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GUILE2: softcode GC environment tuning (issue 563500045 by hanwenn@gmail.com)

jonas.hahnfeld
Reply | Threaded
Open this post in threaded view
|

Re: GUILE2: softcode GC environment tuning (issue 563500045 by hanwenn@gmail.com)

hanwenn
Reviewers: hahnjo,

Message:

commit 4078b52f67e6e5193e72648a8f1a44e8154636e7
Author: Han-Wen Nienhuys <[hidden email]>
Date:   Sat Feb 8 21:04:28 2020 +0100

    GUILE2: softcode GC environment tuning
   
    Disable multithreaded GC and explain why
   
    https://sourceforge.net/p/testlilyissues/issues/5718
    http://codereview.appspot.com/561390043



Description:
GUILE2: softcode GC environment tuning

Disable multithreaded GC and explain why

Please review this at https://codereview.appspot.com/563500045/

Affected files (+15, -2 lines):
  M lily/main.cc


Index: lily/main.cc
diff --git a/lily/main.cc b/lily/main.cc
index 925d0c304c33eeccba48ecc999bb3de0229bc9d7..90a983edad71934ed943c2b5970efb50b6b0545e 100644
--- a/lily/main.cc
+++ b/lily/main.cc
@@ -725,7 +725,6 @@ setup_guile_gc_env ()
 }
 
 #if (GUILEV2)
-extern unsigned long GC_free_space_divisor;
 
 void
 setup_guile_v2_env ()
@@ -749,8 +748,22 @@ setup_guile_v2_env ()
   // it's roughly this value.
   sane_putenv ("GC_INITIAL_HEAP_SIZE", "40M", false);
 
+  /*
+    Empirically, multithreaded GC doesn't change wall time. It just
+    adds another thread that burns 30% of the time.
+
+    David K mentions: "I think that this may be due to both/either our
+    use of mark hooks and of finalisers for calling destructors.
+    Either may cause serialisation.  Another serialisation is because
+    Guile itself switches BGC to Java mode where finalised objects can
+    no longer be marked (or something like that: the exact semantics I
+    do not remember).  And of course the C++ free store still has to
+    do its full job.
+  */
+  sane_putenv ("GC_NPROCS", "1", false);
+
   // Use less CPU for GC, at the expense of memory.
-  GC_free_space_divisor = 1;
+  sane_putenv ("GC_FREE_SPACE_DIVISOR", "1", false);
 }
 #endif