unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludovic.courtes@laas.fr (Ludovic Courtès)
To: Kevin Ryde <user42@zip.com.au>
Cc: guile-devel@gnu.org
Subject: Re: cell heap usage in 1.8 vs 1.6
Date: Fri, 12 Oct 2007 12:08:04 +0200	[thread overview]
Message-ID: <87ve9cmyrf.fsf@laas.fr> (raw)
In-Reply-To: <87r6k32u66.fsf@laas.fr> ("Ludovic Courtès"'s message of "Wed\, 10 Oct 2007 11\:30\:41 +0200")

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

Hi,

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

>   * the heap gets more and more underutilized, although it seems to
>     eventually stabilize somewhere around 5% (!) utilization (i.e.,
>     total/alive = 20);

The main reason appears to be that the size of individual segments grows
exponentially (it's computed in `scm_i_get_new_heap_segment ()').  This
can be seen by regularly dumping the result of the following expression:

  (map (lambda (elem)
         (abs (- (cdr elem) (car elem))))
       (assoc-ref (gc-stats) 'cell-heap-segments))

The default value of `scm_max_segment_size' is
`SCM_DEFAULT_MAX_SEGMENT_SIZE' and is as large as 20MiB (!).  Setting it
to 64KiB, using the `GUILE_MAX_SEGMENT_SIZE' environment variable,
reduces the total heap size (not shown here) by a factor of 2, and
significantly improves the total-to-alive heap ratio:


[-- Attachment #2: The thing --]
[-- Type: image/png, Size: 6511 bytes --]

[-- Attachment #3: Type: text/plain, Size: 604 bytes --]


A side effect of using a smaller maximum segment size is that
`scm_i_adjust_min_yield ()' gets called more frequently (from
`scm_gc_for_newcell ()'), which explains the "smoother" increases of the
min yield.

Using the script I posted earlier, I get the following execution times
for 2500 iterations:

  * max-segment-size = 64 KiB

    real    3m1.167s
    user    2m56.200s
    sys     0m2.220s

  * max-segment-size = 20 MiB

    real    3m29.047s
    user    3m22.392s
    sys     0m4.764s

Thus it would be sensible to change `SCM_DEFAULT_MAX_SEGMENT_SIZE' to
some smaller value.

Thanks,
Ludovic.

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

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

      reply	other threads:[~2007-10-12 10:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-17  0:28 cell heap usage in 1.8 vs 1.6 Kevin Ryde
2007-08-20 22:16 ` Ludovic Courtès
2007-08-23  0:58   ` Kevin Ryde
2007-08-23  8:37     ` Ludovic Courtès
     [not found]       ` <878x7vb64r.fsf@zip.com.au>
2007-08-29 11:36         ` Ludovic Courtès
2007-10-08 14:00 ` Ludovic Courtès
2007-10-10  9:30 ` Ludovic Courtès
2007-10-12 10:08   ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ve9cmyrf.fsf@laas.fr \
    --to=ludovic.courtes@laas.fr \
    --cc=guile-devel@gnu.org \
    --cc=user42@zip.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).