From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id C1547BB81 for ; Mon, 28 Nov 2005 09:38:48 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jAS8cl3U023470 for ; Mon, 28 Nov 2005 09:38:47 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA09788 for ; Mon, 28 Nov 2005 09:38:47 +0100 (MET) Received: from irma.motion-twin.com (irma.motiontwin.com [213.186.50.39]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jAS8ckIZ032494 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Mon, 28 Nov 2005 09:38:47 +0100 Received: from [82.225.176.25] (helo=[192.168.0.1]) by irma.motion-twin.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.54) id 1EgeX7-0008I8-KG; Mon, 28 Nov 2005 09:38:45 +0100 Message-ID: <438AC2AE.3040200@motion-twin.com> Date: Mon, 28 Nov 2005 09:41:18 +0100 From: Nicolas Cannasse User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christophe Raffalli Cc: Brian Hurt , caml-list@inria.fr Subject: Re: [Caml-list] Obj or not Obj References: <4387ACC9.2040107@motion-twin.com> <438A4CAA.6070006@univ-savoie.fr> In-Reply-To: <438A4CAA.6070006@univ-savoie.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 438AC217.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 438AC216.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; cannasse:01 ncannasse:01 motion-twin:01 caml-list:01 rec:01 rec:01 ocaml's:01 mutable:01 val:01 minor:01 mutable:01 val:01 pointers:01 minor:01 allocating:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 > Just a small word about one of my bad experiment with Obj about tail rec > map ... it is easy to get a tail > rec map using Obj to make ocaml's list mutable ... it is just slower > that the original map and using roughly the same > amount of memory, because every cons cell you gain ... is now in the > list of grey val as soon as your list does not > fit in the minor heap anymore !! So even writing you own mutable_list > type would be as bad ! > > Explanation: the list of grey val is a list of pointers from the major > heap to the minor heap which > are created when using mutable data structure and which would break > incremental GC if each minor GC did not scan > the list of grey val) ... This is not correct. When you're building a mutable list you're allocating first in the minor heap, then all cons go into the major heap at once, so only the "last" cons before a GC cycle is greyed. It is indeed true that for short lists, using the stack is better than using mutable structures. But using the stack is getting speed against correctness, since it will overflow for big lists. Nicolas