From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL,MAILTO_TO_SPAM_ADDR, SPF_PASS autolearn=disabled version=3.1.3 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 161D1BC69 for ; Sun, 15 Jul 2007 13:42:59 +0200 (CEST) Received: from kraid.nerim.net (smtp-100-sunday.nerim.net [62.4.16.100]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6FBgwSc027311 for ; Sun, 15 Jul 2007 13:42:58 +0200 Received: from hector.lesours (ours.starynkevitch.net [213.41.244.95]) by kraid.nerim.net (Postfix) with ESMTP id 4D0BCCF05F for ; Sun, 15 Jul 2007 13:42:58 +0200 (CEST) Received: from [192.168.0.1] (glinka.lesours [192.168.0.1]) by hector.lesours (Postfix) with ESMTP id 7F49820F236 for ; Sun, 15 Jul 2007 13:42:33 +0200 (CEST) Message-ID: <469A082A.70303@starynkevitch.net> Date: Sun, 15 Jul 2007 13:42:34 +0200 From: Basile STARYNKEVITCH User-Agent: Mozilla-Thunderbird 2.0.0.4 (X11/20070621) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: unboxed scalars - was [Caml-list] caml: camlp4 revised syntax References: <4699FB8A.2020504@menta.net> In-Reply-To: <4699FB8A.2020504@menta.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 469A0842.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; basile:01 basile:01 unboxed:01 camlp:01 syntax:01 compiler:01 unboxed:01 compilation:01 ocaml:01 ocaml:01 iirc:01 unboxing:01 unboxing:01 faiencerie:01 92340:01 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: basilestarynkevitchnet | mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***