From: Hugo Ferreira <hmf@inescporto.pt>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Optimizing symbolic processing code
Date: Fri, 16 Jan 2009 14:15:47 +0000 [thread overview]
Message-ID: <49709693.50201@inescporto.pt> (raw)
In-Reply-To: <200901161341.53632.jon@ffconsultancy.com>
Jon Harrop wrote:
> 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?
>
Yes. Give or take a second I get the following embarrassingly large
difference:
~/workspace/planner$ time swipl -f prolog.pl -g "win(A, B, C, D, E, F),
halt."
/home/hugof/workspace/planner/docs/prolog.pl compiled 0.00 sec, 8,560 bytes
real 0m30.278s
user 0m30.222s
sys 0m0.012s
~/workspace/planner$ time ./itest_1.p.native
real 19m12.786s
user 19m6.728s
sys 0m0.196s
>> 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.
>
Unfortunately not. I am just scanning the Trie repeatedly. I do this
using functional like code using only folds and finds.
> 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.
>
Yep. Blue Strom has already pointed out the link. Not quite what I am
looking for.
>> 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.
>
Was afraid of that.
Thanks.
HF.
next prev parent reply other threads:[~2009-01-16 14:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-16 8:42 Hugo Ferreira
2009-01-16 9:05 ` [Caml-list] " blue storm
2009-01-16 9:44 ` Hugo Ferreira
2009-01-16 13:41 ` Jon Harrop
2009-01-16 14:15 ` Hugo Ferreira [this message]
2009-01-16 16:14 ` Peter Ilberg
2009-01-16 16:19 ` Hugo Ferreira
2009-01-16 19:09 ` Andrej Bauer
2009-01-16 20:48 ` Andrej Bauer
2009-01-17 9:28 ` Hugo Ferreira
2009-01-17 11:39 ` Andrej Bauer
2009-01-17 15:47 ` Hugo Ferreira
2009-01-17 16:08 ` Hugo Ferreira
2009-01-16 21:46 ` Kuba Ober
2009-01-17 9:46 ` Hugo Ferreira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49709693.50201@inescporto.pt \
--to=hmf@inescporto.pt \
--cc=caml-list@yquem.inria.fr \
--cc=jon@ffconsultancy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox