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=1.5 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, 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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 88387BB84 for ; Fri, 16 Jan 2009 22:46:47 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmMZAF+PcElDWxLCYGdsb2JhbACBbJIOHiqsEYYmhkaFcg X-IronPort-AV: E=Sophos;i="4.37,278,1231110000"; d="scan'208";a="21609287" Received: from ip67-91-18-194.z18-91-67.customer.algx.net (HELO server1.bertec.net) ([67.91.18.194]) by mail3-smtp-sop.national.inria.fr with ESMTP; 16 Jan 2009 22:46:46 +0100 Received: from pc54.bertec.net (pc54.bertec.net [192.168.2.54]) by server1.bertec.net (Postfix) with ESMTP id 8425C1056C4 for ; Fri, 16 Jan 2009 16:46:46 -0500 (EST) Message-Id: From: Kuba Ober To: caml-list@yquem.inria.fr In-Reply-To: <4970B398.5010100@inescporto.pt> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: [Caml-list] Optimizing symbolic processing code Date: Fri, 16 Jan 2009 16:46:46 -0500 References: <4970488C.9080104@inescporto.pt> <200901161341.53632.jon@ffconsultancy.com> <49709693.50201@inescporto.pt> <4970B398.5010100@inescporto.pt> X-Mailer: Apple Mail (2.930.3) X-Spam: no; 0.00; inference:01 inference:01 compiler:01 ocaml:01 bytecode:01 compiler:01 ocaml's:01 ocaml's:01 ocaml:01 cheers:01 2009:98 warren:98 ain't:98 swi:98 overnight:98 On Jan 16, 2009, at 11:19 AM, Hugo Ferreira wrote: > Peter Ilberg wrote: >> On Friday 16 January 2009 08:42:52 Hugo Ferreira wrote: >>> I have implemented a simple Prolog like inference engine >>> to be used in machine learning algorithms (ILP). My first >>> basic test shows that inference is dismally slow (compared >>> to a Prolog compiler). >>> Consequently I am looking for information on optimizing the code. >> For implementing a Prolog-like language, you might want to look at >> this book on the Warren Abstract Machine: >> http://web.archive.org/web/20030213072337/http://www.vanx.org/archive/wam/wam.html > > Ok, new of this document. But I think this demands too-much effort. What you expect, basically, is for OCaml to magically translate your likely cobbled-together, slowly performing interpreter into a bytecode compiler and a VM. That ain't happening, and it's not OCaml's fault. Try compiling your code in F# and see how fast it runs - I doubt you'll see an improvement of more than an order of magnitude, unless you're really unlucky to hit some OCaml's deficiencies. I doubt that SWI Prolog would be substantially (as in more than an order of magnitude linear constant) slower if it were ported to OCaml. Writing a well-performing Prolog system is not an overnight task, at least not without using some decent compiler/system building libraries, which may not even exist. Cheers, Kuba