Re: if then else



On 2008-02-19, bart demoen <bmd@xxxxxxxxxxxxxx> wrote:
On Tue, 19 Feb 2008 08:33:50 +0000, Jan Wielemaker wrote:

On 2008-02-18, bart demoen <bmd@xxxxxxxxxxxxxx> wrote:

Yap SICS SWI B-Prolog | hProlog
orig 480 590 2980 484 | 360
meant 820 960 9919 730 | 264
equiv 1010 950 10300 1440 | 264
...
Curious is also that == is significantly slower than = on many systems?
Why is that?

Maybe there is a misunderstanding here ?
equiv uses =
meant uses ==

== is not significantly slower in any system; == is marginally faster or
basically the same in all systems, except in B-Prolog; and Neng-Fa has
given the explanation: the B-Prolog compiler generates a new predicate for
the X = [] goal in an if-then-else.

I was a bit quick. I don't know how acurate the measurements are, but
the difference in YAP surprises me a little. SWI crosses a magic number,
but the actual difference is small. As said, unification of ground terms
is a little faster than == due to the fact that the code for == shares
with standard order comparison.

BTW, small performance differences are no problem; in my opinion, a
problem arises when there is a large difference (from 50% up to a factor
three) that favours a bad programming style.

I agree.

--- Jan
.



Relevant Pages

  • Re: if then else
    ... equiv uses = ... basically the same in all systems, except in B-Prolog; and Neng-Fa has ... BTW, small performance differences are no problem; ...
    (comp.lang.prolog)
  • Re: CLP(FD): what is necessary?
    ... implementation in B-Prolog shows surprises (even to Neng-Fa, ... B-Prolog sources are ... The AR that originally designed for programming constraint propagation has a ... description of the semantics in the TPLP paper. ...
    (comp.lang.prolog)
  • Re: question about last call optimization
    ... The version of B-Prolog you used is more than five years old. ... > Neng-Fa Zhou wrote: ... > Here are some timings for different systems of the following predicates ... > similar to the gcd predicates, ...
    (comp.lang.prolog)