From: Basile Starynkevitch <basile@starynkevitch.net>
To: ligand@free.fr
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Would it be possible to add automatic, region-based memory management to OCaml?
Date: Mon, 09 Apr 2018 14:26:04 +0200 [thread overview]
Message-ID: <6618a201557cf5ede5aaf15eb0ed21d8@starynkevitch.net> (raw)
In-Reply-To: <1ecada996e0b0d0069daf03241622159@free.fr>
On 2018-04-09 07:20, ligand@free.fr wrote:
> Dear list,
>
> Would it be possible to have automatic, region-based memory management
> in OCaml?
Everything is possible in theory..... The real question is who would pay
for that....
(in practice, that might mean a project of several years and several
millions euros.... If your organization is willing to spend that, please
tell....)
>
> Also, would it have a better run-time performance than using the
> current GC?
>
> Would it completely replace the GC or would the two systems have to
> cohabit?
>
> I have seen even optimized OCaml programs spend 20% of their time doing
> GC.
> I wonder if parts of those 20% could go away.
This is naive. GC is not "lost time", it is acceptable run-time
overhead.
Imagine you rewrite your code in e.g. Rust or C++. Then you still need
to allocate (and deallocate) heap memory. And that cost CPU time and
memory overhead.
So, even if by magic you replace the GC by some region-based memory
allocation, you won't win in practice 20%
To say it otherwise, even C malloc or C++ ::operator new have some
measurable overhead; in some programs it is more than 20%.
In practice, Ocaml's GC is very well written and is one of the most
competitive ones. And the GC is intimately tied to the code generator,
so changing the GC would require significant compiler changes.
There is no silver bullet.
https://en.wikipedia.org/wiki/No_Silver_Bullet
A good tutorial on GC is http://gchandbook.org/
Cheers.
--
Basile Starynkevitch http://starynkevitch.net/Basile
France (opinions are only mine)
next prev parent reply other threads:[~2018-04-09 12:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-09 5:20 ligand
2018-04-09 12:26 ` Basile Starynkevitch [this message]
2018-04-15 16:16 ` David Teller
2018-04-16 15:31 ` Bruno Blanchet
2018-04-17 10:10 ` [Caml-list] Would it be possible to add automatic, region-based Oleg
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=6618a201557cf5ede5aaf15eb0ed21d8@starynkevitch.net \
--to=basile@starynkevitch.net \
--cc=caml-list@inria.fr \
--cc=ligand@free.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