<div dir="ltr"><div>CC'ing sarna, who found the pathology.</div><div>The u8vectors were smaller than the still limit, so they were being moved around.</div><div><br></div><div>-- vyzo<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Nov 9, 2019 at 5:44 PM Marc Feeley <<a href="mailto:feeley@iro.umontreal.ca">feeley@iro.umontreal.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
> On Nov 9, 2019, at 10:02 AM, Dimitris Vyzovitis <<a href="mailto:vyzo@hackzen.org" target="_blank">vyzo@hackzen.org</a>> wrote:<br>
> <br>
> Thanks Marc!<br>
> <br>
> Just to be clear, the pause times are not currently causing an issue for me.<br>
> <br>
> 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<br>
> <br>
> -- vyzo<br>
<br>
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).<br>
<br>
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).<br>
<br>
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):<br>
<br>
Without the parallel GC the pause time per GC:<br>
(real-time . .48944687843322754)<br>
(real-time . .35641002655029297)<br>
(real-time . .3395528793334961)<br>
<br>
With the parallel GC (./configure --enable-multiple-threaded-vms) the pause time per GC:<br>
(real-time . .23423385620117188)<br>
(real-time . .17566204071044922)<br>
(real-time . .1841750144958496)<br>
<br>
Marc<br>
<br>
<br>
(declare (standard-bindings) (extended-bindings) (not safe))<br>
<br>
(define obj<br>
  (let loop ((i 10000000) (result '()))<br>
    (if (fx> i 0)<br>
        (loop (fx- i 1)<br>
              (let ((vect (make-u8vector 10)))<br>
                (cons vect<br>
                      result)))<br>
        result)))<br>
<br>
(pp (assoc 'real-time (##exec-stats ##gc)))<br>
(pp (assoc 'real-time (##exec-stats ##gc)))<br>
(pp (assoc 'real-time (##exec-stats ##gc)))<br>
<br>
<br>
</blockquote></div>