From: Bruno De Fraine <Bruno.De.Fraine@vub.ac.be>
To: caml-list ml <caml-list@inria.fr>
Subject: Re: [Caml-list] plc, a One-Day Prolog Compiler
Date: Mon, 4 Jun 2007 15:32:54 +0200 [thread overview]
Message-ID: <4AD44E18-F634-47FA-BC34-6AD100AB615B@vub.ac.be> (raw)
In-Reply-To: <05F057DE-3838-47A7-9ECC-813057C0BB9F@vub.ac.be>
[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]
An addendum to my previous message:
Some preliminary benchmarks indicate that plc is a vastly faster
execution platform than tried-and-tested (and optimized) Prolog
engines such as SWI Prolog and Sicstus Prolog (although it currently
only supports a restricted language).
For my example program, it is almost 12x faster than SWI and 3.7x
faster than Sicstus.
Some details: solving the win-predicate in the attached Prolog-file
causes a search in the space of all six-letter words (i.e. 26^6
strings); it reports those words that are "prolog". I collected the
following timings on my computer (Intel Core 2 Duo, MacOS X 10.4.9):
SWI-Prolog (Multi-threaded, Version 5.6.10):
$ time swipl -s prolog.pl -g true -t "win(A,B,C,D,E,F),write
([A,B,C,D,E,F]),nl,fail"
% prolog.pl compiled 0.00 sec, 4,280 bytes
[p, r, o, l, o, g]
real 0m59.065s
user 0m58.845s
sys 0m0.073s
SICStus 4.0.1:
$ time ~/sicstus/bin/sicstus -f -l prolog.pl --goal "win
(A,B,C,D,E,F),write([A,B,C,D,E,F]),nl,fail;halt."
% compiling /Users/bruno/my_svn/plc/prolog.pl...
% compiled /Users/bruno/my_svn/plc/prolog.pl in module user, 0 msec
2312 bytes
SICStus 4.0.1 (i386-darwin-8.9.1): Tue May 15 14:53:23 CEST 2007
Licensed to Bruno De Fraine
[p,r,o,l,o,g]
real 0m18.474s
user 0m18.417s
sys 0m0.038s
plc and ocamlopt 3.09.3:
$ time { make prolog.cmx; make driver.cmx; ocamlopt -o driver.opt
prolog.cmx driver.cmx; ./driver.opt; }
ocamlopt.opt -c -dtypes -pp 'camlp4 ./plc.cma pr_dump.cmo -impl' -
impl prolog.pl
ocamlopt.opt -c -dtypes driver.ml
prolog
real 0m5.069s
user 0m4.749s
sys 0m0.191s
Regards,
Bruno
[-- Attachment #2: prolog.pl --]
[-- Type: text/x-perl-script, Size: 425 bytes --]
letter(a).
letter(b).
letter(c).
letter(d).
letter(e).
letter(f).
letter(g).
letter(h).
letter(i).
letter(j).
letter(k).
letter(l).
letter(m).
letter(n).
letter(o).
letter(p).
letter(q).
letter(r).
letter(s).
letter(t).
letter(u).
letter(v).
letter(w).
letter(x).
letter(y).
letter(z).
winner(p,r,o,l,o,g).
win(A,B,C,D,E,F) :-
letter(A),
letter(B),
letter(C),
letter(D),
letter(E),
letter(F),
winner(A,B,C,D,E,F).
[-- Attachment #3: driver.ml --]
[-- Type: application/octet-stream, Size: 155 bytes --]
let soa = Prolog.string_of_atom ;;
Prolog.win_oooooo (fun a b c d e f ->
print_endline ((soa a) ^ (soa b) ^ (soa c) ^ (soa d) ^ (soa e) ^ (soa f))
) ;;
[-- Attachment #4: Type: text/plain, Size: 213 bytes --]
--
Bruno De Fraine
Vrije Universiteit Brussel
Faculty of Applied Sciences, DINF - SSEL
Room 4K208, Pleinlaan 2, B-1050 Brussels
tel: +32 (0)2 629 29 75
fax: +32 (0)2 629 28 70
e-mail: Bruno.De.Fraine@vub.ac.be
prev parent reply other threads:[~2007-06-04 13:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-31 14:39 Bruno De Fraine
2007-06-04 13:32 ` Bruno De Fraine [this message]
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=4AD44E18-F634-47FA-BC34-6AD100AB615B@vub.ac.be \
--to=bruno.de.fraine@vub.ac.be \
--cc=caml-list@inria.fr \
/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;
as well as URLs for NNTP newsgroup(s).