Re: WAM Vs. TOAM
- From: "Neng-Fa Zhou" <nzhou@xxxxxxx>
- Date: Mon, 12 Nov 2007 11:29:44 -0500
"bart demoen" <bmd@xxxxxxxxxxxxxx> wrote in message
news:pan.2007.10.10.20.08.35.237050@xxxxxxxxxxxxxxxxx
I HAVE a Prolog program (*) that B-Prolog (just downloaded) runs
a little slower than GNU-Prolog 1.3.0
a little slower than XSB 3.1
at half the speed of SICStus Prolog 3.12
at a little less than 1/4th of the speed of Yap 5.1.1
at 1/4th of the speed of hProlog 2.7.35
GNU Prolog, XSB, SICStus, Yap and hProlog are all WAM based.
B-Prolog is TOAM Jr based.
All these systems are emulators - except GNU-Prolog which is a hybrid
between an emulator and a native code generating system (inheriting
most of the disadvantages of both, and almost none of the advantages
of either).
This is not surprising. In the paper on TOAM Jr., the following
discussion
is made: "It is easy to find program patterns that make one machine
arbitrarily worse than the other. Nevertheless, our investigation of a
large
number of programs shows that last calls have more to share with the heads
than first calls in most tail recursive procedures.".
Here is a typical program that favors TOAM or any abstract machine that has
arguments passed throught the stack:
top:-p(1000,2,3,4,5,6,7,8,9,10,11,12,13,14,15).
p(1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14,X15):-!.
p(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14,X15):-
dummy(X1=X15),
NewX1 is X1-1,
p(NewX1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14,X15).
dummy(X):-call(X),!.
dummy(X).
I got the following timings, all in ms on Windows XP, from different Prolog
systems (all except for B-Prolog are WAM-based):
B-Prolog(7.1beta) 187
Yap(5.1.1) 375
Sicstus(4.0) 578
BinProlog(11.24) 906
SWI(5.6.6) 2203
XSB(3.1) 2844
GNU-Prolog(1.2.16) 5047
Let me see your program and see if the difference in speed is attributed to
the design or implementation.
Cheers,
Neng-Fa
.
- Follow-Ups:
- Re: WAM Vs. TOAM
- From: fodor.paul@xxxxxxxxx
- Re: WAM Vs. TOAM
- From: bart demoen
- Re: WAM Vs. TOAM
- Prev by Date: Re: Restricting equivalent solutions inside the search (B-Prolog)
- Next by Date: Which prolog to embed in a win32 app?
- Previous by thread: Counting recursion calls
- Next by thread: Re: WAM Vs. TOAM
- Index(es):
Relevant Pages
|
|