[gambit-list] Real-time or generational gc?

Marc Feeley feeley at iro.umontreal.ca
Sat Nov 9 10:44:06 EST 2019


> On Nov 9, 2019, at 10:02 AM, Dimitris Vyzovitis <vyzo at hackzen.org> wrote:
> 
> Thanks Marc!
> 
> Just to be clear, the pause times are not currently causing an issue for me.
> 
> There is a gerbil however who has been investigating pause times and found a pathological program that allocates u8vectors and stuffs them into a hash table. In that case, there is an accumulation of memory, leading to pause times of 500-600ms, while racket averages 20ms (with a peak of about 170ms) on the equivalent program. This is clearly an artifact of generational gc, but it always vexes me when racket seemingly does better at something :p
> 
> -- vyzo

It would be good to investigate this further because the behaviour you describe is not the one I would have expected, assuming the u8vectors are not small (i.e. >= 2033 bytes on a 64 bit machine).  That’s because non-small objects are allocated as still objects and aren’t moved by the GC and the content isn’t even looked at by the GC (so a generational GC will not help).

Perhaps the racket code is not “equivalent”.  What is the total run time of the racket code compared to Gambit?  Generational GC may reduce the time to do garbage collection, but slow down other operations (such as assignments).

Concerning the parallel GC, there is a good 2x performance boost for a heap that contains a list of 10 million u8vectors of length 10 (see attached code):

Without the parallel GC the pause time per GC:
(real-time . .48944687843322754)
(real-time . .35641002655029297)
(real-time . .3395528793334961)

With the parallel GC (./configure --enable-multiple-threaded-vms) the pause time per GC:
(real-time . .23423385620117188)
(real-time . .17566204071044922)
(real-time . .1841750144958496)

Marc


(declare (standard-bindings) (extended-bindings) (not safe))

(define obj
  (let loop ((i 10000000) (result '()))
    (if (fx> i 0)
        (loop (fx- i 1)
              (let ((vect (make-u8vector 10)))
                (cons vect
                      result)))
        result)))

(pp (assoc 'real-time (##exec-stats ##gc)))
(pp (assoc 'real-time (##exec-stats ##gc)))
(pp (assoc 'real-time (##exec-stats ##gc)))





More information about the Gambit-list mailing list