caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Brian Hurt <bhurt@spnz.org>
To: "Michael D. Adams" <mdmkolbe@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Efficency of varient types
Date: Sun, 27 Nov 2005 12:08:56 -0600 (CST)	[thread overview]
Message-ID: <Pine.LNX.4.63.0511271155540.24132@localhost.localdomain> (raw)
In-Reply-To: <c62c8d860511270735v2366b474m75b6084a0055f8d5@mail.gmail.com>



On Sun, 27 Nov 2005, Michael D. Adams wrote:

> I should clarify what I am proposing because it also only requires one
> word.  The bottom one or two bits of that word would say which variant
> it is.  The remaining bits representing any data with that variant.
> (Obviously this would only work if the associated data is small
> enough, but fortunately most of the primitives are small enough (e.g.
> int (31 bits), bool (1 bit), char (8 bits).))

Except that this runs into the problem of knowing the subtle details of 
the GC- not only how it works now, but what (if any) gaurentees are being 
given for future development.  For example, is it gaurenteed that the GC 
will recognize words with the low two bits being 10 as not pointers?  Or 
does the low bit being 0 means the GC may (or may not) assume it's a 
pointer, and weird word values would cause the GC to segfault?  Even if it 
works now, will it continue to work with Ocaml 3.10, 3.20, 4.0, etc.  I 
don't know- I don't work at INRIA.  This is exactly what I was warning 
about earlier.

The other thing I'll throw in here is a warning against premature 
optimization.  OK, so method A is 15x slower than method B.  But how big 
of an effect will this have on the overall program?  If method B is one 
clock cycle, and method A is 15 clock cycles, probably not much.  15 clock 
cycles is about the cost of one mispredicted branch, and much, much 
cheaper than a cache miss.  If you're doing anything at all interesting, 
the most likely case is that the 14 clock difference will be minor 
compared to the costs of the rest of the program.

Brian


  reply	other threads:[~2005-11-27 18:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-25 23:53 Michael D. Adams
2005-11-26  0:31 ` [Caml-list] " Nicolas Cannasse
2005-11-26  1:22   ` Brian Hurt
2005-11-26  9:39     ` Nicolas Cannasse
2005-11-28  0:17     ` Obj or not Obj Christophe Raffalli
2005-11-28  8:41       ` [Caml-list] " Nicolas Cannasse
2005-11-28  9:27         ` Christophe Raffalli
2005-11-28  9:33         ` skaller
2005-11-28  8:43       ` Alain Frisch
2005-11-26  2:54   ` [Caml-list] Efficency of varient types skaller
2005-11-27  5:06   ` Michael D. Adams
2005-11-27  5:45     ` Brian Hurt
2005-11-27 10:02       ` Nicolas Cannasse
2005-11-27 15:35       ` Michael D. Adams
2005-11-27 18:08         ` Brian Hurt [this message]
2005-12-02 15:07           ` Michael D. Adams
2005-11-26  1:18 ` Jon Harrop
2005-11-27 14:57 ` Lukasz Stafiniak
2005-11-27 15:47   ` Lukasz Stafiniak
2005-11-28  8:14   ` Christophe Raffalli
2005-11-28  7:24 ` David Baelde
2005-11-28  7:49   ` Jacques Garrigue
2005-11-28 10:01     ` Jon Harrop
2005-11-28 10:26       ` Luc Maranget
2005-11-28  7:53   ` Ville-Pertti Keinonen
2005-12-01 17:05 ` Stefan Monnier
2005-12-02 15:07   ` [Caml-list] " Michael D. Adams

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=Pine.LNX.4.63.0511271155540.24132@localhost.localdomain \
    --to=bhurt@spnz.org \
    --cc=caml-list@inria.fr \
    --cc=mdmkolbe@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).