Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Optimizing symbolic processing code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-01-16 (13:38)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Optimizing symbolic processing code
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: 
> 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 

Dr Jon Harrop, Flying Frog Consultancy Ltd.