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.9 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id C9351BC6E for ; Thu, 16 Aug 2007 01:52:39 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l7FNqdlb027841 for ; Thu, 16 Aug 2007 01:52:39 +0200 Received: by ug-out-1314.google.com with SMTP id o2so210738uge for ; Wed, 15 Aug 2007 16:52:39 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=lEMHGtxPN9ePTVEJngvF3rT6nazZ6ke/GybZaczKQNi4KvSkUrA/xUxYbGpYGzA2oKTGWosxj8IJLvRqmnqBWpM4pN0/1TWIDg7HVJ7y77hrQsKZAsPKkiuo/KOaCBD2QsTMshYE2/r3LEtQujxfcvwEFYeJLD71K1USj9x1uUQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=eIZBH/+l2X/P1/KxgSRzmTpNJkUEiaH+WM5oQZLrQx5NRB/6TbiU3x1ZE7ar5igx5hcn0lckgXMhRE6YxclQcB7i9I5DcFAeTxy5usJByfvGnJyCuetahaHJRAlVx01LR2yHKn0EqlUledyOGtBi3dqFw5hRV2o4c4Uw9f2tmaI= Received: by 10.67.26.7 with SMTP id d7mr1749683ugj.1187220426168; Wed, 15 Aug 2007 16:27:06 -0700 (PDT) Received: from ?192.168.1.33? ( [83.33.68.230]) by mx.google.com with ESMTPS id f8sm170377nfh.2007.08.15.16.27.04 (version=SSLv3 cipher=OTHER); Wed, 15 Aug 2007 16:27:05 -0700 (PDT) In-Reply-To: <200708151618.38165.jon@ffconsultancy.com> References: <2B9157A5-ECA0-46EE-B628-840689224ACC@gmail.com> <200708151401.41091.jon@ffconsultancy.com> <200708151618.38165.jon@ffconsultancy.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <3C3EDB59-44C1-4C3A-AD96-C762B986F39C@gmail.com> Cc: caml-list@yquem.inria.fr Content-Transfer-Encoding: 7bit From: Joel Reymont Subject: Re: [Caml-list] High-performance bytecode interpreter in OCaml Date: Thu, 16 Aug 2007 00:26:49 +0100 To: Jon Harrop X-Mailer: Apple Mail (2.752.3) X-j-chkmail-Score: MSGID : 46C391C7.000 on discorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at discorde with ID 46C391C7.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bytecode:01 ocaml:01 bytecode:01 lowercase:01 opcode:01 ocamlopt:01 2007,:98 closures:01 closures:01 wrote:01 rec:01 compile:01 compile:01 caml-list:01 int:01 On Aug 15, 2007, at 4:18 PM, Jon Harrop wrote: > let rec compile bytecode = match bytecode with > | 0x83::x::t -> > let x = String.lowercase (string_of_int x) in > let t = compile t in > (fun k -> print_string x; k t) I'm curious, would this be any faster than doing whatever the 0x83 opcode requires and then just invoking (compile t)? Does it actually make sense to convert the whole bytecode file into a chain of closures and then execute it repeatedly? Would there be a huge gain compared to interpreting every time? I guess it would make sense if closures could be compiled into machine code "just in time" or if my VM was compiled using ocamlopt. I'm not sure, though, so I'm looking for input. Thanks, Joel -- http://wagerlabs.com