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.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 1AF31BC0A for ; Fri, 22 Dec 2006 13:37:44 +0100 (CET) Received: from pih-relay06.plus.net (pih-relay06.plus.net [212.159.14.133]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id kBMCbhOT009457 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 22 Dec 2006 13:37:43 +0100 Received: from [80.229.56.224] (helo=[10.0.0.5]) by pih-relay06.plus.net with esmtp (Exim) id 1Gxjeb-0003MC-UF for caml-list@yquem.inria.fr; Fri, 22 Dec 2006 12:37:38 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Scripting in ocaml Date: Fri, 22 Dec 2006 12:35:12 +0000 User-Agent: KMail/1.9.5 References: <6dbd4d000612201941wcd4b09anc503a13889576512@mail.gmail.com> <458AF864.20902@hq.idt.net> <458AFC39.70707@philippewang.info> In-Reply-To: <458AFC39.70707@philippewang.info> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200612221235.12273.jon@ffconsultancy.com> X-Miltered: at concorde with ID 458BD197.004 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 verbose:01 ocaml:01 runtime:01 arrays:01 pointer:01 run-time:01 run-time:01 arrays:01 blas:01 frog:98 polymorphic:01 wrote:01 slower:01 caml-list:01 On Thursday 21 December 2006 21:27, Philippe Wang wrote: > If you want to do that, use Lisp... Lisp is too slow. > Or use sum types... > type t = Int of int | Float of float | ... Manual boxing is too verbose. > OCaml forgets types at runtime! Some type related information is certainly retained, e.g. to unbox float arrays. > This means that you can't know without a huge cost (cf. SafeUnmarshal > costs), because what you can do in O(1) is to know whether a value is an > int or a pointer... I'd like to quantify this cost. I've read papers and heard work stating that carrying run-time type information can be cheap but I see evidence that might point to the contrary, e.g. F# is significantly slower than OCaml but it has concurrent GC that was designed for a non-FPL. In F#, you have run-time type information. Amongst other things, this allows you to dispatch to more efficient type-specialised functions. For example, you can write functions over polymorphic arrays and dispatch to optimised BLAS versions for float arrays when the input happens to be a float array. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists