caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe Raffalli <christophe.raffalli@univ-savoie.fr>
To: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
Cc: Damien Doligez <damien.doligez@inria.fr>,
	OCaml mailing list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Optimizing garbage collection
Date: Tue, 23 Nov 2010 17:43:47 +0100	[thread overview]
Message-ID: <4CEBEF43.10800@univ-savoie.fr> (raw)
In-Reply-To: <4CEBC432.1090804@univ-savoie.fr>

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

Le 23/11/2010 14:40, Christophe Raffalli a écrit :
> 
> Hello,
> 
> May be running a minimisation algorithm to minimize (promoted_words per
> minor collection / minor_heap_size)  Could be good ?
> 

This was stupid has it converges toward zero when we increase minor_heap_size.

However, the following piece of code worked well for PML benchmark (4'30" became 3'02") :
(remark that HALVING the minor_heap_size does occur too)

I really do not know if such strategy is reasonnable as a default ?
If the 0.10 and 0.005 in the code are any reasonnable ?

-------------------8<---------------------
open Gc

let param = get ()

let old_promoted_words = ref 0.0
let old_minor_collections = ref 0
let minor_heap_size = ref param.minor_heap_size

let _ = create_alarm (fun () ->
  let s = quick_stat () in
  let promoted_words = s.promoted_words in
  let minor_collections = s.minor_collections in
  let delta_promoted_words = promoted_words -. !old_promoted_words in
  let delta_minor_collections = minor_collections - !old_minor_collections in
  old_promoted_words := promoted_words;
  old_minor_collections := minor_collections;
  let ratio = delta_promoted_words /. (float) delta_minor_collections
                                   /. (float) !minor_heap_size
  in
  if ratio > 0.10 then begin
    minor_heap_size := !minor_heap_size * 2;
(*  Printf.fprintf stderr "MHS DOUBLED <- %d (ratio %f)\n" !minor_heap_size ratio;
    flush stderr; *)
    set { get () with minor_heap_size = !minor_heap_size }
  end else if ratio < 0.005 then begin
    minor_heap_size := max 32768 (!minor_heap_size / 2);
(*  Printf.fprintf stderr "MHS HALFED <- %d (ratio %f)\n" !minor_heap_size ratio;
    flush stderr; *)
    set { get () with minor_heap_size = !minor_heap_size }
  end)
-------------------8<---------------------

-- 
Christophe Raffalli
Universite de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tel: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature. The public key is
stored on www.keyserver.net
---------------------------------------------


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  reply	other threads:[~2010-11-23 16:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1832704169.1010021.1290451094930.JavaMail.root@zmbs1.inria.fr>
2010-11-23  9:48 ` Damien Doligez
2010-11-23 13:40   ` Christophe Raffalli
2010-11-23 16:43     ` Christophe Raffalli [this message]
2010-11-18 15:51 Eray Ozkural
2010-11-19 14:54 ` [Caml-list] " Michael Ekstrand
2010-11-19 15:49   ` Eray Ozkural
2010-11-20  2:20   ` Eray Ozkural
2010-11-21 18:13     ` Alexandre Pilkiewicz
2010-11-21 19:26       ` Eray Ozkural
     [not found]       ` <577267187.967802.1290367612809.JavaMail.root@zmbs1.inria.fr>
2010-11-22 15:10         ` Damien Doligez
2010-11-22 16:27           ` Mauricio Fernandez
2010-11-22 18:38           ` John Carr

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

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

  git send-email \
    --in-reply-to=4CEBEF43.10800@univ-savoie.fr \
    --to=christophe.raffalli@univ-savoie.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=damien.doligez@inria.fr \
    /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 NNTP newsgroup(s).