caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Basile STARYNKEVITCH <basile@starynkevitch.net>
To: caml-list@yquem.inria.fr
Subject: Re: unboxed scalars - was [Caml-list] caml: camlp4 revised syntax
Date: Sun, 15 Jul 2007 13:42:34 +0200	[thread overview]
Message-ID: <469A082A.70303@starynkevitch.net> (raw)
In-Reply-To: <4699FB8A.2020504@menta.net>

tmp123@menta.net wrote:
> Hello,
> 
> First of all, thanks to all people who develops this language and 
> related tools, and to people who supports them using it.
> 
> I decided to use it in several developments. When finished, the 
> developed modules will be made public, if they are enough generic (best 
> place to publish it?)
> 
> Two points still causing some troubles:
> 
> 1) The internal integer coding:
> 
> It seems that an integer of value "x" is internally stored like "2x*1" ( 
> x shift 1 or 1 ). That is a loss of performance, not only when doing 
> calculations, but also, by example, when using the integer as index of a 
> string character, ... . Usage of native-int doesn't improves the subject.

This is unlikely to change any soon. It is (nearly) required by polymorphic functions (like List.map).

Changing it would require a very major change of the compiler, which should specialize all polymorphic functions for 
such unboxed scalar types. If it was done, it would require either a whole program compilation, or a possible 
(exponential) bloat of generated code size (basically for each polymorphic function, you would have to generate all the 
scalar forms in addition of the polymorphic one).

I'm not an Ocaml implementation expert, so I could be wrong, and I would be delighted to be confirmed or infirmed by the 
Ocaml guru implementors (e.g. Xavier Leroy).

IIRC, the ML/Ton implementation is rumored to do this kind of unboxing.

Besides, I am pretty sure than on current processors, unboxing scalars is probably more a win because of memory & cache 
issues than because of the additional shift & add required to transform a 2n+1 into n or vice versa. Such ALU operations 
are very cheap today.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net | mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***


  reply	other threads:[~2007-07-15 11:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.7.1184494090.1020.caml-list@yquem.inria.fr>
2007-07-15 10:48 ` tmp123
2007-07-15 11:42   ` Basile STARYNKEVITCH [this message]
2007-07-15 13:16     ` unboxed scalars - was [Caml-list] " Gerd Stolpmann
2007-07-15 17:50     ` Christophe Raffalli
2007-07-16 16:40   ` Richard Jones
2007-07-17  3:08   ` Jon Harrop
2007-07-21 11:31 ` dml tmp123

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=469A082A.70303@starynkevitch.net \
    --to=basile@starynkevitch.net \
    --cc=caml-list@yquem.inria.fr \
    /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).