Re: WAM Vs. TOAM



"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



.



Relevant Pages

  • Re: ...I just assumed they were all the same.
    ... > install XSB Prolog. ... It allows you to declare some predicates as "tabled" in ...
    (comp.lang.prolog)
  • Re: Newbie Question: Reading older grammar rule code...
    ... Hope this isn't too much of an RTFM question: I'm pretty new to Prolog ... trying to get a piece of code from the mid-80s to ... GNU-Prolog gives a compliation error, for example, here at the ... [Var], [char, ascii, ...
    (comp.lang.prolog)
  • Newbie Question: Reading older grammar rule code...
    ... Hope this isn't too much of an RTFM question: I'm pretty new to Prolog ... trying to get a piece of code from the mid-80s to ... GNU-Prolog gives a compliation error, for example, here at the ... [Var], [char, ascii, ...
    (comp.lang.prolog)
  • Re: A few questions about Prolog...
    ... few Prolog implementations, and would appreciate if the community ... SWI-Prolog uses a lot of memory for stacks? ... could find in favor of GNU-Prolog is a good choice of GUI. ...
    (comp.lang.prolog)
  • Re: Are Logtalk objects "real" objects?...
    ... integration with SICStus Prolog that should lead to good performance. ... multifile predicates, ... such as Logtalk. ...
    (comp.lang.prolog)