guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Garbage collector tuning?


From: Jan Wedekind
Subject: Re: Garbage collector tuning?
Date: Thu, 10 Sep 2015 17:33:25 +0100 (BST)
User-agent: Alpine 2.11 (DEB 23 2013-08-11)

On Thu, 10 Sep 2015, Ludovic Courtès wrote:
Jan Wedekind <address@hidden> skribis:

I wonder whether there is a more performant way to allocate larger
memory blocks (e.g. 1 MByte). "gc-malloc-pointerless" seems to be much
slower than "malloc":

                                           user     system      total        
real
    Guile allocate memory              0.003780   0.000020   0.003800 (  
0.003810)
    C allocate memory                  0.000060   0.000000   0.000060 (  
0.000070)

It isn’t fair to compare GC_malloc_pointerless with malloc.  Instead, it
should be compared with interleaved malloc + free sequences.

You should find more on this topic on the home page of libgc, the GC
that Guile uses: <http://www.hboehm.info/gc/>

Yes, I agree. The sequence malloc, free, malloc, free, ... is not a representative use-pattern. However I only forced a single garbage collector run for a 1000 tests.
The full benchmark is here by the way:

                                           user     system      total        
real
    Guile GOOPS method dispatch        0.000060   0.000000   0.000060 (  
0.000050)
    Guile make empty sequence          0.000690   0.000000   0.000690 (  
0.000700)
    Guile allocate memory              0.003760   0.000020   0.003780 (  
0.003800)
    Guile negate empty sequence        0.003500   0.000080   0.003580 (  
0.003580)
    Guile make sequence                0.002620   0.000020   0.002640 (  
0.002660)
    Guile negate sequence              0.006980   0.000030   0.007010 (  
0.007030)
    C allocate memory                  0.000060   0.000000   0.000060 (  
0.000070)
    C negate empty sequence            0.000050   0.000000   0.000050 (  
0.000040)
    C negate sequence                  0.000720   0.000000   0.000720 (  
0.000720)


Is there a way to control how often the garbage collector is run?

The file doc/README.environment in libgc describes some useful
environment variables, notably these:

 GC_INITIAL_HEAP_SIZE=<bytes> -   Initial heap size in bytes.  May speed up
                                 process start-up.

 GC_MAXIMUM_HEAP_SIZE=<bytes> - Maximum collected heap size.

 GC_MARKERS=<n> - Linux w/threads and parallel marker only.  Set the number
                 of marker threads.  This is normally set to the number of
                 processors.  It is safer to adjust GC_MARKERS than GC_NPROCS,
                 since GC_MARKERS has no impact on the lock implementation.

Guile also honors the ‘GC_FREE_SPACE_DIVISOR’ environment variable.  See
the comments in gc.h for the meaning of this one.

Ok, I'll play around with it. Thanks for the information.


HTH,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]