From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 0E0EC8240C for ; Mon, 9 Apr 2018 14:26:13 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=basile@starynkevitch.net; spf=Pass smtp.mailfrom=basile@starynkevitch.net; spf=None smtp.helo=postmaster@ovh.starynkevitch.net Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of basile@starynkevitch.net) identity=pra; client-ip=46.105.17.220; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="basile@starynkevitch.net"; x-sender="basile@starynkevitch.net"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of basile@starynkevitch.net designates 46.105.17.220 as permitted sender) identity=mailfrom; client-ip=46.105.17.220; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="basile@starynkevitch.net"; x-sender="basile@starynkevitch.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@ovh.starynkevitch.net) identity=helo; client-ip=46.105.17.220; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="basile@starynkevitch.net"; x-sender="postmaster@ovh.starynkevitch.net"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3A12KjCxFn5EgS2xfOpSsWgZ1GYnF86YWxBRYc798d?= =?us-ascii?q?s5kLTJ7yp8mwAkXT6L1XgUPTWs2DsrQY07GQ6/iocFdDyK7JiGoFfp1IWk1Nou?= =?us-ascii?q?QttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZr?= =?us-ascii?q?KeTpAI7SiNm82/yv95HJbAhEmDSwbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+?= =?us-ascii?q?NYxWNpIVKc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M24XKIIaS2bJMNJnCYJ?= =?us-ascii?q?WP6vUdwPzxar4SXz0LtjI6Lv5iQCpJTg2cZ0++bT3UU4/Cd1C8m1yH2EVXBynW?= =?us-ascii?q?4WRiM93OZ5rFArmQTL6rRxn/ENTY8b3PhOSApva8aFnr5KTuvqUweERe+nDVOv?= =?us-ascii?q?Q9GoGzY0F4Nj2MMHeVd7GNi8jwzI32ysDqNHzuXXVqxxybrV2j3KH+g402zPjf?= =?us-ascii?q?hzlEUvWNpJNmC4h7J0907VCpKbyxzExZbvTrwV2Wv2zEnGzWeKuxsDAgluUePe?= =?us-ascii?q?QXkFd03VoMr4+kjCCbmjFeZ/Pw=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0ATBwBrW8ta/9wRaS5bg3ADYW8ojD+ML?= =?us-ascii?q?IF0gQ+ScYFmCyOCBoJaAgiCMRkHAQQ0FAECAQEBAQEBAQEBaxwMgjUMDAOCUgE?= =?us-ascii?q?BAQECATgCBgEBJwEPAQ8EBxguVxkIFoRXAwMKDAEKpA2DCYJuAQEFhBAMgSyCF?= =?us-ascii?q?giFIIJLghODYi6BVIEyCwIDgSGBBIUIkFGGeAiFVohXZFY7gyCHNokBG4EDhWe?= =?us-ascii?q?BIwIzIYFSewo6gkMJgj+IDTuFQD0wj0kBAQ?= X-IPAS-Result: =?us-ascii?q?A0ATBwBrW8ta/9wRaS5bg3ADYW8ojD+MLIF0gQ+ScYFmCyO?= =?us-ascii?q?CBoJaAgiCMRkHAQQ0FAECAQEBAQEBAQEBaxwMgjUMDAOCUgEBAQECATgCBgEBJ?= =?us-ascii?q?wEPAQ8EBxguVxkIFoRXAwMKDAEKpA2DCYJuAQEFhBAMgSyCFgiFIIJLghODYi6?= =?us-ascii?q?BVIEyCwIDgSGBBIUIkFGGeAiFVohXZFY7gyCHNokBG4EDhWeBIwIzIYFSewo6g?= =?us-ascii?q?kMJgj+IDTuFQD0wj0kBAQ?= X-IronPort-AV: E=Sophos;i="5.48,427,1517871600"; d="scan'208";a="261373853" Received: from ovh.starynkevitch.net ([46.105.17.220]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Apr 2018 14:26:11 +0200 Received: from ovh.starynkevitch.net (localhost [127.0.0.1]) by ovh.starynkevitch.net (Postfix) with ESMTP id B4881A08F0 for ; Mon, 9 Apr 2018 14:26:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= starynkevitch.net; h=user-agent:message-id:references :in-reply-to:subject:subject:to:from:from:date:date :content-transfer-encoding:content-type:content-type :mime-version; s=dkim; t=1523276764; x=1524140765; bh=illG/hfjUf 0w2Kzftl4ZsrsRR8S9TyRI31erqm/7bkU=; b=JAIoXJt9M6gqd4YQ4exrff8281 e4G9uYvUIENmYfZIECuSeOLRInwYtEUhngZxxwOw/HyJXxjpZqihGMglcNn24sH5 DoKvWzsip8w2J0QvyuvWFnNdix4wSGoe9/5X5fiommIYhepfv6XOUVssinT9chlz LWdLP1ztQL0THjBe8= X-Virus-Scanned: Debian amavisd-new at ovh.starynkevitch.net Received: from ovh.starynkevitch.net ([127.0.0.1]) by ovh.starynkevitch.net (ovh.starynkevitch.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id dDMuMdW7Rwmn for ; Mon, 9 Apr 2018 14:26:04 +0200 (CEST) Received: from _ (localhost [127.0.0.1]) by ovh.starynkevitch.net (Postfix) with ESMTPSA id 1AFDAA01F2; Mon, 9 Apr 2018 14:26:04 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 09 Apr 2018 14:26:04 +0200 From: Basile Starynkevitch To: ligand@free.fr Cc: caml-list@inria.fr In-Reply-To: <1ecada996e0b0d0069daf03241622159@free.fr> References: <1ecada996e0b0d0069daf03241622159@free.fr> Message-ID: <6618a201557cf5ede5aaf15eb0ed21d8@starynkevitch.net> X-Sender: basile@starynkevitch.net User-Agent: Roundcube Webmail Subject: Re: [Caml-list] Would it be possible to add automatic, region-based memory management to OCaml? 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)