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.7 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 204B9BB84 for ; Mon, 22 Dec 2008 17:57:07 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlABAI5VT0nUnw4RlGdsb2JhbACCO5EuAQEBAQkLCAkRA6piWI94hkM X-IronPort-AV: E=Sophos;i="4.36,264,1228086000"; d="scan'208";a="18795981" Received: from pih-relay04.plus.net ([212.159.14.17]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 22 Dec 2008 17:57:06 +0100 Received: from [87.114.38.62] (helo=leper.local) by pih-relay04.plus.net with esmtp (Exim) id 1LEo5Z-0003vX-Ly for caml-list@yquem.inria.fr; Mon, 22 Dec 2008 16:57:05 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] More Caml Date: Mon, 22 Dec 2008 17:00:08 +0000 User-Agent: KMail/1.9.9 References: <157727.93194.qm@web111508.mail.gq1.yahoo.com> <20081220093640.a8da1a8c.mle+ocaml@mega-nerd.com> <200812192253.15207.jon@ffconsultancy.com> In-Reply-To: <200812192253.15207.jon@ffconsultancy.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812221700.09010.jon@ffconsultancy.com> X-Plusnet-Relay: 80f7310ad16403b3890a1e2b14be4e00 X-Spam: no; 0.00; compiler:01 ocaml:01 ocamlopt:01 arrays:01 extern:01 printf:01 ocaml:01 compiler:01 lacks:01 datatypes:01 polymorphism:01 run-time:01 compilation:01 ocamlopt:01 native-code:01 On Friday 19 December 2008 22:53:15 Jon Harrop wrote: > On Friday 19 December 2008 22:36:40 Erik de Castro Lopo wrote: > > Jon Harrop wrote: > > > I have actually already started this using the excellent LLVM project > > > and I just obtained the first promising results yesterday: a simple > > > benchmark where my compiler runs OCaml code 3x faster than ocamlopt > > > does. > > > > Is this going to be an open source project? > > Yes. Just to update: I've spent a couple more days playing with this. I now have unit, bools, ints, floats, arrays, fast internal calling convention with tail calls, C-compatible external calling convention, arbitrary extern functions, C printf, multiple function arguments and multiple function return values (passed on the stack!). I have written a few tiny benchmarks and the results compared to OCaml on x86 are promising: Float Fibonacci: 2.9x faster than OCaml. Sieve of Eratosthenes: 1.8x faster than OCaml. Mandelbrot: 2.9x faster than OCaml. The compiler is only ~500LOC. The language still lacks closures, a garbage collector, algebraic datatypes, pattern matching, polymorphism, exceptions, run-time types and safety (!). However, it already has some killer features: . Declare and then call C functions directly. . No 16Mb limits. . Very fast JIT compilation (2x faster than ocamlopt). . Easy incremental native-code compilation for a REPL. . Efficient polymorphism. LLVM even does a decent job of statically type checking the code, which helps a lot when debugging (once you get used to the error messages!). I'll probably write a front end or REPL using camlp4 and then port my ray tracer benchmark to it. After that, I'll look at some more features: . Algebraic data types and a kind of switch over them as a poor man's pattern matching. . Run-time type information and generic printing. . Real polymorphism. . Garbage collection. This begs the question: what is the simplest possible concurrent GC? Merry Christmas, -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e