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 (21:46)
From: Kuba Ober <ober.14@o...>
Subject: Re: [Caml-list] Optimizing symbolic processing code

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:
> 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  
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)  
if it were ported to OCaml.

Writing a well-performing Prolog system is not an overnight task, at  
not without using some decent compiler/system building libraries, which
may not even exist.

Cheers, Kuba