home *** CD-ROM | disk | FTP | other *** search
Prolog Source | 1989-02-11 | 2.9 KB | 90 lines |
- /* Prolog benchmark from IEEE Micro 2/89
- Last revised: 2/10/89
-
- Adapted to Turbo Prolog by:
- Chris Petersen
- 7600 Penn Ave. S. #202
- Richfield, MN 55423
- Compuserve: 71046,1214
- GENIE: C.PETERSEN
-
- For the full text of the Prolog article see:
- IEEE Micro
- February 1989, Page 10
-
- This program was benchmarked against various Prolog/computer combinations.
- A summary of the results follows:
-
- Machine System Performance (LIPS) Reference
- Xenologic X1 (TTL)/Compiled 200-400K
- Berkeley PLM (TTL)/Compiled 305,000 NCR 9300 Host
- IBM 3081 VM/Prolog 200,000 IBM IJCAI
- Symbolics 3600 Microcoded 53,000 Cassels
- DEC 2060 Warren Compiled 43,000 Warren
- Japan's 5th Gen PSI Microcoded 30,000 Taki
- IBM 3033 Waterloo 27,000 Warren
- 80286 12 mHz (Est) Turbo Pro. 2.0 24,700 Petersen
- VAX 11/780 Macrocoded 15,000 Est
- Sun-2 Quintus Compl 14,000 Warren
- V20 10 mHz MS-DOS Turbo Pro. 2.0 8,300 Petersen
- LMI/Lambda Uppsala 8,000 Warren
- IBM XT (Est) Turbo Pro. 2.0 3,300 Petersen
- VAX 11/780 Prolog 2,000 Warren
- VAX 11/780 M-Prolog 2,000 Warren
- VAX 11/780 C-Prolog 1,500 Warren
- Symbolics 3600 Interpreter 1,500 Warren
- PDP 11/70 Interpreter 1,000 Warren
- Z80 Micro Prolog 120 Warren
- Apple II Interpreter 8 Warren
-
- This program requires 0.5*N^2 + 1.5*N + 1 logical inferences. For a list of
- 30 items, 496 logical inferences must be made. For a run time of 0.06 secs,
- the number of Logical Inferences Per Second (LIPS) is 496/.06 = 8267.
-
- The results? Turbo Prolog stacks up quite well against the competition.
- Running on a 12 mHz 80286 it is faster than all of the implementations tested
- on the VAX 11/780. It is still a factor of 10 slower than the top performing
- Prologs. Not too bad for a microcomputer!
-
- Keep in mind, however, that this is a very simple benchmark and does not take
- into account other types of programs which are more generally used in the real
- world. It is, however, a very simple and nice comparison tool.
- */
-
- domains
- L0, L1, L2, L3 = integer*
- numbers = integer*
- X = integer
-
- predicates
-
- nreverse(numbers, numbers).
- concatenate(numbers, numbers, numbers).
-
-
- goal
-
- write("\nTurbo Prolog benchmark program. See comments in the source file."),
- write("\nC.Petersen - Compuserve 71046,1214, GENIE C.PETERSEN.\n"),
- time(H1,M1,S1,D1),
- nreverse([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
- 21,22,23,24,25,26,27,28,29,30],L),
- time(H2,M2,S2,D2),
- write("\nThe reversed list is:",L),
- write("\n\nStop time :",H2,":",M2,":",S2,".",D2),
- write("\nStart time:",H1,":",M1,":",S1,".",D1),
- Result=H2*3600-H1*3600+M2*60-M1*60+S2-S1+(D2-D1)/100,
- write("\nElapsed time:",Result," seconds"),
- write("\n\n").
-
- clauses
-
- nreverse([X|L0],L) :- nreverse(L0,L1),
- concatenate(L1,[X],L).
-
- nreverse([],[]).
-
- concatenate([X|L1],L2,[X|L3]) :-
- concatenate(L1,L2,L3).
-
- concatenate([],L,L).