Re: In which cases/problems is Prolog faster than Java?



On 2008-05-19, Christina <christine.uk2000@xxxxxxxxx> wrote:
I have implemented sorting algorithms like merge sort, tree sort and
bubble sort in both Java and Trinc-Prolog, hoping to prove that Prolog
runs faster than Java....Unfortunately, for large amount of data
(30000 input size), Trinc-Prolog dies and Java runs in 2 or 3
miliseconds....for small input, still Java is better in comparison
with Trinc-Prolog. I will also test minimax algorithm for checkers,

I don't think Trinc-Prolog is known for speed. Better try YAP. No decent
Prolog should have problems with a list of 30,000 items. Still,
merge-sort on 30,000 items in SWI-Prolog takes 0.25 seconds on my
machine (AMD 5400+). YAP might get this down by a factor 10. Built-in
sort in SWI-Prolog does the job in about 2.5 milliseconds :-)

both in Java and in Prolog, but this will take some time....firstly, I
am interested in small problems that would prove Prolog's efficiency
over Java.

I guess basically the answer is none. Like no program runs faster in
Java than it runs in well a crafted assembler program. The value of
Prolog is mostly in expressing the problem more concisely. It is best
at problems that involve some form of non-deterministic search.

Cheers --- Jan

I want to know which problems work better in Prolog than in Java, so
that I can continue my study.
Thank you,
Christine
.



Relevant Pages