caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Brian Hurt <bhurt@spnz.org>
Cc: "Seth J. Fogarty" <sfogarty@gmail.com>, caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list]  References, compact bollean values (and other questions)
Date: Fri, 04 Nov 2005 13:39:43 +1100	[thread overview]
Message-ID: <1131071984.10871.50.camel@rosella> (raw)
In-Reply-To: <Pine.LNX.4.63.0511031805480.1006@localhost.localdomain>

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 <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


      reply	other threads:[~2005-11-04  2:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-03 23:34 Seth J. Fogarty
2005-11-04  0:20 ` [Caml-list] " Brian Hurt
2005-11-04  2:39   ` skaller [this message]

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=1131071984.10871.50.camel@rosella \
    --to=skaller@users.sourceforge.net \
    --cc=bhurt@spnz.org \
    --cc=caml-list@inria.fr \
    --cc=sfogarty@gmail.com \
    /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).