Re: multisets



On Wed, 27 Feb 2008 20:53:09 +0000, Jan Wielemaker wrote:

Even after a small enhancement of numlist, I get this (SWI-Prolog
5.6.51 with this enhancement, 64-bit version on AMD3800+):

?- time(findall(X,between(0,1000000,X),Items)).
% 1,000,012 inferences, 0.57 CPU in 0.64 seconds (90% CPU, 1754407 Lips)
Items = [0, 1, 2, 3, 4, 5, 6, 7, 8|...].

?- time(numlist(0, 1000000, X)).
% 2,000,009 inferences, 0.72 CPU in 0.77 seconds (93% CPU, 2777790 Lips)
X = [0, 1, 2, 3, 4, 5, 6, 7, 8|...].

I must admit I was a bit surprised as well (and the performance of
findall/3 has almost doubled a few months ago). I would suspect
SWI-Prolog is one of the few systems for which the findall/between
attack is faster than numlist

Sure enough - in other systems numlist is between 4 and 15 times faster !
One reason is maybe the SWI implementation of if-then-else.
If I replace between/2 with something in plain Prolog, the timings tend to
be worse for findall/mybetween.

Such surprises (on top of that experienced by the author of a systems)
must be very confusing for users.

Cheers

Bart Demoen

.



Relevant Pages

  • Re: multisets
    ... findall/3 has almost doubled a few months ago). ... Such surprises ... programming languages. ... switch ...
    (comp.lang.prolog)
  • Re: multisets
    ... with the lib that much, ... Even after a small enhancement of numlist, ... findall/3 has almost doubled a few months ago). ... SWI-Prolog is one of the few systems for which the findall/between ...
    (comp.lang.prolog)