Re: multisets
- From: Jan Wielemaker <jan@xxxxxxxxxxxxxxxxxxx>
- Date: 28 Feb 2008 10:48:23 GMT
On 2008-02-28, Bart Demoen <bmd@xxxxxxxxxxxxxxxxx> wrote:
Jan Wielemaker wrote:
Anyone with a rough model of Prolog execution will assume that the
findall/between version is slower. Ok, on one particular system it is
the other way around, but by so little it doesn't matter much which
option you choose.
Eh, no.
As a user I expect the numlist version to be faster by a factor 4 to 15
(according to my measurements on other systems, that is reasonable).
So if in a particular system, the numlist version is as slow as the findall
version, the difference between what I expected to get and what I actually get
is huge, not little - and so it does matter.
Well, that depends. If you *need* the list of integers, there are
these two choices (in a lot of variations of course). So you take
numlist/3 and you are happy on (I hope) all systems. If you have the
choice to solve your problem without generating the list of integers,
things may become different. Still, the
non-findall/assert/whatever-database-operation version is generally
faster on most Prolog systems, given equal complexity of the
algorithm.
Of course it is annoying that the execution time of your algorithm is
hard to estimate on a particular Prolog platform and thus a
`non-portable' aspect of the program.
This is not new and not unique to Prolog. SWI-Prolog uses two
radically different implementations for message queues between threads
(Windows/Unix), because after simple porting of the Unix implemention
using pthread-win32 the Windows version was 100 times slower. This
was caused by pthread-win32 sticking too close to the POSIX semantics
for condition variables. A weaker conforming implementation that
still satisfied Prolog's needs could be implemented, getting
comparable performance.
I have encountered many similar issues in the operating system
interfaces. Annoying, but a fact of life. The good news it that as
long as there is a healthy competition some of these issues are
resolved.
Cheers --- Jan
.
- References:
- multisets
- From: Stephan Lukits
- Re: multisets
- From: bart demoen
- Re: multisets
- From: Chip Eastham
- Re: multisets
- From: bart demoen
- Re: multisets
- From: Jan Wielemaker
- Re: multisets
- From: bart demoen
- Re: multisets
- From: Jan Wielemaker
- Re: multisets
- From: Bart Demoen
- multisets
- Prev by Date: Re: multisets
- Next by Date: Applications of VisiRule
- Previous by thread: Re: multisets
- Next by thread: Reading a line of text in Prolog
- Index(es):
Relevant Pages
|