Re: In which cases/problems is Prolog faster than Java?
- From: Duncan Patton <campbell@xxxxxxxxxx>
- Date: Wed, 21 May 2008 08:49:51 GMT
On Tue, 20 May 2008 09:47:24 -0700 (PDT)
Isaac Gouy <igouy2@xxxxxxxxx> wrote:
On May 20, 5:25 am, Cameron Hughes <cahug...@xxxxxxxxxx> wrote:
Christina 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,
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 want to know which problems work better in Prolog than in Java, so
that I can continue my study.
Thank you,
Christine
Problems that involve unification, depth first search, recursion,
serious list manipulation will be better implemented in Prolog.
Its not just the speed. Its the process of implementing the solution.
You will require two or three times the amount of code to implement
unification and DFS, and list processing in Java than it takes in
Prolog.
also after you done implementing it in Java maintaining it will be
(somewhat of a challenge)
So comparing qsort, bubble sort, etc is not a good metric.
There are list manipulation techniques in Prolog that can easily be done
in a single line
of Prolog that would require many lines of Java. The same is true for
Prolog algorithms
that rely on unification, DFS and recursion. I've had to convert Prolog
code to Java and
C++ its (almost) never a pretty sight. And the C++ and Java
programmers that have
to maintain it always feel trepidation.
Suggestions for new benchmarks game problems are welcome, make them on
the discussion forum or preferably make a feature request
http://shootout.alioth.debian.org/gp4sandbox/faq.php#help
The difficulty we run up against trying to find problems that show
Prolog in a good light is that in other languages the functionality
for the obvious solutions to those problems is in a library rather
than in the language.
And it's awkward simply requiring recursion or requiring lists (rather
than allowing iteration and arrays) so if you know of specific
problems which have solutions that are awkward but not impossible
using iteration and arrays ...
Seems kinda pointless. The place where Prolog shines over other
languages is in saving _programmer_ time, not machine time.
Dhu
.
- References:
- In which cases/problems is Prolog faster than Java?
- From: Christina
- Re: In which cases/problems is Prolog faster than Java?
- From: Cameron Hughes
- Re: In which cases/problems is Prolog faster than Java?
- From: Isaac Gouy
- In which cases/problems is Prolog faster than Java?
- Prev by Date: Re: Networking in Prolog - a survey
- Next by Date: Re: Why Prolog code from Wikipedia doesn't run?
- 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
|