Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!zombie.ncsc.mil!paladin.american.edu!news.ecn.uoknor.edu!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: speed of prolog
Message-ID: <9516822.6049@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU (CS-Usenet)
Organization: Computer Science, University of Melbourne, Australia
References: <3rjth8$5k4@percy.cs.bham.ac.uk> <DA5vLn.5o0@ecrc.de> <3rmperINNp9k@bhars12c.bnr.co.uk>
Date: Sat, 17 Jun 1995 12:30:38 GMT
Lines: 34

John Fletcher <J.S.Fletcher@bnr.co.uk> writes:

>thom@ecrc.de (Thom Fruehwirth) wrote:
>>
>>Arrays usually have fixed size and in that case using simply
>>Prolog terms gives you constant time access as in other languages.
>>
>>E.g. 
>>	:- functor(Array,array,100),	% "declare Array" as term with 100 arguments)
>>	   ...
>>	   arg(57,Array,Element57),	% access 57th element of the array

Yes, but that only works for write-once arrays.
What's the Prolog equivalent to 

	a[57] := a[57] + 1;

?

>As James said in his original posting - access to array elements is basically
>log(N).
[...]
>This is true in every language, the relative speed of Prolog is down to
>compiler technologies - not the language.

The compiler technology required to convert ordinary Prolog code into
code using mutable arrays is beyond the current state of the art.
Other languages don't require the compiler writer to solve such difficult
problems to get competetive performance.

-- 
Fergus Henderson
fjh@cs.mu.oz.au
http://www.cs.mu.oz.au/~fjh
