Re: In which cases/problems is Prolog faster than Java?
- From: Bart Demoen <bmd@xxxxxxxxxxxxxxxxx>
- Date: Tue, 20 May 2008 09:32:31 +0200
Christina wrote:
Does minimax algorithm work faster in Prolog than in Java?
Some 10 years ago, when Java was only byte-code emulated, there was a
paper (or tech report) by (I think) Spanish people (UPM probably) who
showed with some benchmarks that Java and Prolog had roughly the same
performance (on some benchmarks, including qsort if I remember
right). I repeated some of those benchmarks myself at that time and it
depended a bit on which Prolog system one uses, and how one writes
particular constructs (if-then-else or multiple clauses with cut for
instance), but Java and Prolog were indeed close in speed.
In the mean time, Java execution technology has moved to JIT with
accordingly higher performance, while Prolog has mainly stayed
emulated. So you should expect that Java implementations are faster
(by an order of magnitude) than Prolog implementations. And that's all
you will be able to compare anyway: one implementation versus another
implementation, not one language versus another language. It's all in
the compiler technology that is used, nothing intrinsic in the
language, at least not for toy benchmarks where "everything is known".
BTW, you version of mergesort runs on lists of 30000 elements easily
in SWI, so you should blame the Trinc-Prolog implementation, not
Prolog - again the implementation and not a language.
A couple of weeks ago, a colleague from the numerical analysis group
said proudly that he had written a Sudoku solver and that he was
positively impressed that his program found the solution to a
newspaper puzzle in under 2 minutes. Now we know it is easy to write a
Sudoku solver in Prolog (and even easier in Prolog+constraints) that
solves puzzles in about a millisecond. It turned out that my colleague
had written his solver in MatLab ... so Prolog is faster than MatLab ?
Cheers
Bart Demoen
.
- Follow-Ups:
- Re: In which cases/problems is Prolog faster than Java?
- From: Jan Wielemaker
- Re: In which cases/problems is Prolog faster than Java?
- References:
- In which cases/problems is Prolog faster than Java?
- From: Christina
- Re: In which cases/problems is Prolog faster than Java?
- From: bart demoen
- Re: In which cases/problems is Prolog faster than Java?
- From: Christina
- In which cases/problems is Prolog faster than Java?
- Prev by Date: Re: In which cases/problems is Prolog faster than Java?
- Next by Date: Re: get unused integer
- Previous by thread: Re: In which cases/problems is Prolog faster than Java?
- Next by thread: Re: In which cases/problems is Prolog faster than Java?
- Index(es):
Relevant Pages
|