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 71D73D45F for ; Fri, 4 Nov 2005 03:39:59 +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 jA42dwqj012081 for ; Fri, 4 Nov 2005 03:39:58 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA24257 for ; Fri, 4 Nov 2005 03:39:58 +0100 (MET) Received: from ash25e.internode.on.net (ash25e.internode.on.net [203.16.214.182]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jA42duLS012076 for ; Fri, 4 Nov 2005 03:39:57 +0100 Received: from rosella (ppp7-104.lns1.syd7.internode.on.net [59.167.7.104]) by ash25e.internode.on.net (8.12.9/8.12.6) with ESMTP id jA42di4r042640; Fri, 4 Nov 2005 13:09:45 +1030 (CST) (envelope-from skaller@users.sourceforge.net) Subject: Re: [Caml-list] References, compact bollean values (and other questions) From: skaller To: Brian Hurt Cc: "Seth J. Fogarty" , caml-list In-Reply-To: References: Content-Type: text/plain Date: Fri, 04 Nov 2005 13:39:43 +1100 Message-Id: <1131071984.10871.50.camel@rosella> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 436AC9FE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 436AC9FC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 mutable:01 mutable:01 pointers:01 integers:01 integers:01 unboxed:01 2005,:98 wrote:01 wrote:01 sourceforge:01 imho:01 slower:01 structures:01 tuples: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.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Thu, 2005-11-03 at 18:20 -0600, Brian Hurt wrote: > > On Thu, 3 Nov 2005, Seth J. Fogarty wrote: > > > First question: I notice references are implemented using mutable > > records. Does this imply tuples of references are slower than mutable > > records? > > I.E. > > type a = int ref * int ref * int ref > > vs > > type a = {mutable a : int; mutable b : int; mutable c : int} > > The mutable structure will almost certainly be less memory and faster. > The tuple of structures will be a tuple of three pointers to three > different mutable integers. The structure will simply be three integers, > stored unboxed in the structure. Yes but note it depends what you are doing. A field is NOT a first class value. A reference is. So if you use functional update to rebuild a record, you are not tickling the write barrier -- true even if a field is a reference. So it depends what you are doing with these records, IMHO. -- John Skaller Felix, successor to C++: http://felix.sf.net