caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Török Edwin" <edwintorok@gmail.com>
To: Fabrice Le Fessant <fabrice@lefessant.net>
Cc: bluestorm <bluestorm.dylc@gmail.com>,
	Gerd Stolpmann <info@gerd-stolpmann.de>,
	caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Is OCaml fast?
Date: Mon, 22 Nov 2010 20:33:34 +0200	[thread overview]
Message-ID: <20101122203334.7adc5ee6@deb0> (raw)
In-Reply-To: <AANLkTinrvZRXzn5eFvyB2E4_CR_7+XU1zRtbNQLjMhVS@mail.gmail.com>

On Mon, 22 Nov 2010 17:46:49 +0100
Fabrice Le Fessant <fabrice@lefessant.net> wrote:

> 2010/11/22 Török Edwin <edwintorok@gmail.com>:
> > Isn't it possible for the GC to realise its doing too many
> > collections and increase the minor heap size on its own?
> 
> Indeed, it could notice that a lot of data is being moved to the major
> heap, and double its size in consequence, until a maximum limit is
> reached.

I did some benchmarks on 2 CPUs, and here are the wall clock times
for GC minor heap size:

"minorheap","      phenomII",,,"               core2",,,"cycle diff %"
,"              time",,"      cycles","time",,"      cycles",
32,"           17.76","17.74",56.8," 48.60","48.86",58.48,2.96
64,"           16.81","16.80",53.78,"44.79","44.79",53.75,-0.06
128,"          15.41","15.38",49.26,"41.38","40.76",49.28,0.04
256,"          14.39","14.35",45.98,"39.75","38.98",47.24,2.74
512,"          12.97","13.15",41.79,"35.75","35.59",42.8,2.42
1024,"         12.89","12.94",41.33,"33.57","33.13",40.02,-3.17
2048,"         11.05","11.09",35.42,"29.26","29.12",35.03,-1.1
4096,"         9.79"," 9.81",31.36,"26.21","25.96",31.3,-0.19
8192,"         8.71"," 8.85",28.1," 23.36","23.34",28.02,-0.28
16384,"        7.89"," 7.86",25.2," 21.41","21.54",25.77,2.26
32768,"        7.55"," 7.55",24.16,"20.74","20.88",24.97,3.35

(minorheap is in KWords, time is in seconds, cycles is divided by 10^9)

Increasing minor heap beyond that yielded no improvement (number of
minor heap collections stayed the same).

phenomII has 64 Kb L1 data cache, 512Kb L2 cache, 6144Kb L3 cache
(shared), runs at 3.2Ghz. That would be 516k words if only 1 core used.

core2  has 32 Kb L1 data cache, 4MB L2 cache, runs at 1.2Ghz.
That would be 840k words if only 1 core used.

Both used exact same binaries on 64-bit Linux, ocaml 3.11.2.

Despite the difference in CPUs and heap sizes the number of CPU cycles
spent for a given size of the minor heap is about the same (within 3%
difference).

Not sure what the max should be for the minor heap increase, but based
on this benchmark increasing size of minor heap never slows down the
program. Even when size of minor heap exceeds what fits in the cache.
I guess there is another microbenchmark that can show the opposite
though.

Is there some real world benchmark for OCaml's GC that can be used
to get some better values for minor heap size based on CPU's L2/L3 size
(as suggested in the 'Optimizing garbage collection' thread)?


> 
>  The problem is that it is the kind of things that are application
> dependent,

Yes, maybe optimal size of minor heap doesn't depend on CPU's cache
size but on the application, in which case a heuristic for
increasing/decreasing the heap size may be better?

> and should be put in the program itself (the program would
> have a trigger on each minor heap collection, and, depending on the
> moved bytes, would increase the size of the minor heap). The problem
> is that the Shootout does not allow that, so the winner is the
> language whose runtime allocates the most memory at the beginnning...

If tuning minor heap can double performance of the program, then the GC
should have some heuristics to tune it automatically. Sure applications
which are not happy with that tuning should tune it themselves.

Best regards,
--Edwin


  reply	other threads:[~2010-11-22 18:33 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-22 13:21 Thanassis Tsiodras
2010-11-22 13:35 ` [Caml-list] " Gregory Bellier
2010-11-22 13:39   ` Lukasz Stafiniak
2010-11-22 13:42   ` Thomas Fischbacher
2010-11-22 13:43 ` Sylvain Le Gall
2010-11-22 13:55 ` [Caml-list] " Dario Teixeira
2010-11-23  2:11   ` Isaac Gouy
     [not found]   ` <999386690.746882.1290478813177.JavaMail.root@zmbs4.inria.fr>
2010-11-23  9:12     ` [Caml-list] " Fabrice Le Fessant
2010-11-23 17:56       ` Isaac Gouy
2010-11-23 19:54         ` [Caml-list] " Mark Diekhans
2010-11-23 20:04           ` Isaac Gouy
2010-11-23 22:56   ` [Caml-list] " oliver
2010-11-23 23:54     ` Jon Harrop
2010-11-24  1:24       ` Erik de Castro Lopo
2010-11-25 11:17         ` Jon Harrop
2010-11-22 14:04 ` Gerd Stolpmann
2010-11-22 14:22   ` [was: Re: Is OCaml fast?] OCaml Shootout task force Sylvain Le Gall
2010-11-22 14:36   ` [Caml-list] Is OCaml fast? bluestorm
2010-11-22 15:01     ` Török Edwin
2010-11-22 15:54       ` Goswin von Brederlow
2010-11-22 15:02     ` Gerd Stolpmann
     [not found]     ` <582306206.731582.1290438133628.JavaMail.root@zmbs4.inria.fr>
2010-11-22 16:46       ` Fabrice Le Fessant
2010-11-22 18:33         ` Török Edwin [this message]
2010-11-27 21:11           ` Pierre Etchemaïté
2010-11-28 13:26             ` OCaml GC [was Is OCaml fast?] Christophe Raffalli
2010-11-28 14:29               ` [Caml-list] " Benedikt Meurer
2010-11-28 18:57                 ` Eray Ozkural
2010-11-28 19:40                   ` Jon Harrop
2010-11-28 19:59                     ` Benedikt Meurer
2010-11-28 23:34                       ` Jon Harrop
2010-11-29 12:11                         ` Benedikt Meurer
2010-11-29 22:27                 ` Török Edwin
     [not found]                 ` <916556265.243293.1291069665032.JavaMail.root@zmbs1.inria.fr>
2010-12-02 12:57                   ` Damien Doligez
2010-12-02 15:07                     ` Török Edwin
2010-12-03 21:42                       ` [Caml-list] optimizing caml_modify [was OCaml GC [was Is OCaml fast?]] ygrek
2010-11-23  2:03     ` Is OCaml fast? Isaac Gouy
2010-11-23 10:37       ` [Caml-list] " Christophe TROESTLER
2010-11-23 15:50         ` Jon Harrop
2010-11-23 18:06           ` Isaac Gouy
2010-11-23 21:34             ` [Caml-list] " Jon Harrop
2010-11-23 16:08         ` Jon Harrop
2010-11-23 18:03           ` Isaac Gouy
2010-11-23 19:14             ` [Caml-list] " Török Edwin
2010-11-23 20:17               ` Isaac Gouy
2010-11-23 21:14             ` [Caml-list] " Christophe TROESTLER
2010-11-23 21:55               ` Isaac Gouy
2010-11-23 22:25             ` [Caml-list] " Richard Jones
2010-11-24  0:11               ` Isaac Gouy
2010-11-23 17:53         ` Isaac Gouy
2010-11-23 19:24           ` [Caml-list] " Gerd Stolpmann
2010-11-23 20:28             ` Isaac Gouy
2010-11-23 20:55               ` [Caml-list] " Gerd Stolpmann
2010-11-23 21:32                 ` Isaac Gouy
2010-11-24 22:28             ` [Caml-list] " Goswin von Brederlow
2010-11-23 23:21           ` evil sloot
2010-11-24  6:54             ` [Caml-list] " David Rajchenbach-Teller
2010-11-22 17:02   ` [Caml-list] " Oliver Bandel
2010-11-22 17:08     ` David Rajchenbach-Teller
2010-11-22 17:23       ` Oliver Bandel
2010-11-22 17:54         ` David Rajchenbach-Teller
2010-11-22 23:55         ` Jeff Schultz
2010-11-22 23:28       ` Eray Ozkural
2010-11-23  2:01       ` Isaac Gouy
2010-11-23 23:27         ` [Caml-list] " oliver
2010-11-24  0:23           ` Isaac Gouy
2010-11-24  1:36             ` [Caml-list] " Eray Ozkural
2010-11-24  2:13               ` Isaac Gouy
2010-11-24  4:39                 ` [Caml-list] " Jeff Meister
2010-11-24  6:22                   ` Andrew
2010-11-24  7:16                     ` Isaac Gouy
2010-11-24  6:50                   ` Isaac Gouy
2010-11-24 10:24                     ` [Caml-list] " Christophe Troestler
2010-11-24 11:33                       ` Eray Ozkural
2010-11-24 17:32                       ` Isaac Gouy
2010-11-24 17:57                         ` [Caml-list] " Christophe Raffalli
2010-11-24 19:07                         ` Ed Keith
2010-11-24 19:13                           ` Isaac Gouy
2010-11-24 19:17                             ` [Caml-list] " David Rajchenbach-Teller
2010-11-24 22:25                               ` Oliver Bandel
2010-11-25 16:59                   ` Stefan Monnier
2010-11-25 18:21                     ` Isaac Gouy
2010-11-25 22:11                     ` [Caml-list] " Jon Harrop
     [not found]                     ` <1534555381.33107.1290723160355.JavaMail.root@zmbs4.inria.fr>
2010-11-25 22:50                       ` Fabrice Le Fessant
2010-11-26 20:25                         ` Isaac Gouy
2010-11-27 18:55                         ` Stefan Monnier
2010-11-28 18:14                         ` [Caml-list] " oliver
2010-11-29 14:19                           ` Gerd Stolpmann
2010-11-29 16:12                             ` Threading and SharedMem (Re: [Caml-list] Re: Is OCaml fast?) Oliver Bandel
2010-11-29 16:24                               ` Gerd Stolpmann
2010-11-29 16:33                                 ` Oliver Bandel
2010-11-27 15:58                     ` [Caml-list] Re: Is OCaml fast? Christophe Raffalli
2010-11-28 18:17                       ` oliver
2010-11-29  7:33                         ` Christophe Raffalli
2010-11-29 11:25                           ` Jon Harrop
2010-11-29 11:44                             ` oliver
2010-11-29 17:29                               ` Christophe Raffalli
2010-11-24  6:55               ` David Rajchenbach-Teller
2010-11-24  7:23                 ` Isaac Gouy
2010-11-23  2:06   ` Isaac Gouy
     [not found] ` <1110536178.728445.1290434684177.JavaMail.root@zmbs4.inria.fr>
2010-11-22 16:39   ` [Caml-list] " Fabrice Le Fessant
2010-11-22 17:21     ` Philippe Strauss
2010-11-22 18:33 ` Oliver Bandel
2010-11-23  1:58 ` Isaac Gouy
2010-11-24 10:29 ` [Caml-list] " David Allsopp
2010-11-24 18:39   ` Isaac Gouy
2010-11-24 20:59     ` [Caml-list] " David Allsopp
2010-11-25  0:16       ` Isaac Gouy
2010-11-24 14:07 ` [Caml-list] " Cedric Cellier
2010-11-24 14:34 ` Vincent Aravantinos
2010-11-24 15:30   ` Thanassis Tsiodras
2010-11-24 16:26     ` Oliver Bandel
2010-11-24 16:27     ` Vincent Aravantinos
2010-11-24 18:16 ` Isaac Gouy

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=20101122203334.7adc5ee6@deb0 \
    --to=edwintorok@gmail.com \
    --cc=bluestorm.dylc@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=fabrice@lefessant.net \
    --cc=info@gerd-stolpmann.de \
    /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).