[comp.lang.prolog] Are the wrong races being run?

pop@cs.umass.edu (Robin Popplestone) (06/15/90)

                  Are the wrong races being run?

The main potential advantage of Prolog is as a symbolic programming
language. Of all domains of symbolic processing, perhaps the one which is at
once both firmly founded in mathematics and which outperforms people is
computer algebra (e.g. factorising polynomials over the rationals). For this
fast, arbitrary precision integer and rational arithmetic is essential.

POPLOG timings for successive runs of the call of time in the program below
which tests arbitrary precision multiplication are given:

define factorial(n);
  if n=0 then 1 else n*factorial(n-1)
  endif
enddefine

prolog
:- library(time).
:- time((X is factorial(1000)/factorial(999),print(X))).


 (I put the print in to show the system got the exact integer answer):                 

1000Time for ,
    1.97 secs (CPU)
    0 secs (GC)
1000Time for ,
    1.85 secs (CPU)
    0 secs (GC)
1000Time for ,
    3.31 secs (CPU)
    1.49 secs (GC)
1000Time for ,
    1.7 secs (CPU)
    0 secs (GC)
1000Time for ,
    1.63 secs (CPU)
    0 secs (GC)
1000Time for ,
    3.9 secs (CPU)
    2.12 secs (GC)  [big elapsed time for this GC because of net traffic]

8 Megabyte discless Sun 3/60, some basic POPLOG utilities loaded, various
suntools running. The elapsed-time for the garbage collections varied widely,
depending on net traffic.

I don't have available other Prologs to test, but would be interested to 
hear about timings.

Robin Popplestone.