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.0 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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 907D6BB84 for ; Fri, 16 Jan 2009 14:38:02 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnkBAIgccEnUnw4Sk2dsb2JhbACCO5FIAQEBAQcLCgkRA7lGhXI X-IronPort-AV: E=Sophos;i="4.37,277,1231110000"; d="scan'208";a="33839718" Received: from pih-relay05.plus.net ([212.159.14.18]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/AES256-SHA; 16 Jan 2009 14:38:02 +0100 Received: from [87.112.78.201] (helo=leper.local) by pih-relay05.plus.net with esmtp (Exim) id 1LNotc-0001Qy-RP for caml-list@yquem.inria.fr; Fri, 16 Jan 2009 13:38:01 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Optimizing symbolic processing code Date: Fri, 16 Jan 2009 13:41:53 +0000 User-Agent: KMail/1.9.9 References: <4970488C.9080104@inescporto.pt> In-Reply-To: <4970488C.9080104@inescporto.pt> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901161341.53632.jon@ffconsultancy.com> X-Plusnet-Relay: 8a088f0a4aefd4ed9f77fbc6f963aa9b X-Spam: no; 0.00; inference:01 inference:01 compiler:01 iirc:01 ocaml:01 recursive:01 rewrites:01 iirc:01 ocaml:01 node:01 low-level:01 afaik:01 2009:98 frog:98 prolog:01 On Friday 16 January 2009 08:42:52 Hugo Ferreira wrote: > Hello, > > 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). Can you quantify that? > Consequently I am looking for information on optimizing the code. IIRC, the single most productive optimization I made to the Mathematica implementation I wrote in OCaml was to check when recursive rewrites were leaving an expression unaltered and return the original when possible to avoid copying. I don't know if that is relevant here. Also IIRC, someone else wrote that they lashed together a quick Prolog implementation in OCaml and were surprised to find it outperforming real Prolog compilers. > I have found: > > http://ocaml.janestreet.com/?q=node/30 > http://camltastic.blogspot.com/2008/05/optimizing-memory-allocation-and-loo >ps.html > > Does anyone have any other links or articles I may look at? The articles on low-level optimization in the OCaml Journal are almost certainly relevant. OCaml for Scientists covers data structure performance in detail. No other sources are as comprehensive with regard to optimization AFAIK. -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e