Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!gatech!newsfeed.pitt.edu!uunet!allegra!alice!pereira
From: pereira@alta.research.att.com (Fernando Pereira)
Subject: Re: Indexing (was Re: Help!! union without cut!?)
In-Reply-To: conway@munta.cs.mu.OZ.AU's message of Sun, 16 Apr 1995 08:57:14 GMT
X-Nntp-Posting-Host: alta.research.att.com
Message-ID: <PEREIRA.95Apr16175952@alta.research.att.com>
Sender: usenet@research.att.com (netnews <9149-80593> 0112740)
Reply-To: pereira@research.att.com
Organization: AT&T Bell Laboratories
References: <3ldruq$fka@cpccux0.cityu.edu.hk> <3lejg1$djm@irix.uci.kun.nl>
	<3lo84f$4rk@goanna.cs.rmit.edu.au>
	<HSCHOTEL-0304951429060001@atdmac10.let.kun.nl>
	<3m34ll$304@gaudi.ac.upc.es> <3mfo2q$jc@goanna.cs.rmit.edu.au>
	<9510618.27288@mulga.cs.mu.OZ.AU>
Date: Sun, 16 Apr 1995 21:59:52 GMT
Lines: 34

In article <9510618.27288@mulga.cs.mu.OZ.AU> conway@munta.cs.mu.OZ.AU (Thomas Charles CONWAY) writes:
   I am curious to know why most Prolog implementations has such
   dismal indexing (usually limited to top functor, first argument)
   when indexing has such a big impact on performance. Why do
   implementations not provide indexing at least on the top level
   functors of all head arguments?
Mostly historic precedent. The majority of Prolog programs that were
around when David Warren designed the DEC-10 Prolog compiler
benefitted enormously from 1st-arg indexing. Of course more
sophisticated indexing might have made things even better, but it
would also make the compiler and the generated code bigger. In those
days, size was a much more serious consideration than it is today. In
the WAM, David maintained the same simple indexing scheme (actually,
not in the 1st version). Again, the payoff of 1st-arg indexing for
typical programs of the time as great, but the payoff for more
thorough indexing unclear (of course we were already conditioned in
our programming by the existence of 1st-arg indexing in DEC-10
Prolog).  Without detailed mode and determinacy inference (which I
guess Mercury uses), full indexing would require monster decision
graphs (constrast with the decision graphs for SML patterns, which can
be straightforward because they just do 1-way matching without need
for backtracking). Again, given limited resources (of compiler writers
and machines to run the code), there seemed to be many more important
things to focus on at the time.

--
Fernando Pereira
2B-441, AT&T Bell Laboratories
600 Mountain Ave, PO Box 636
Murray Hill, NJ 07974-0636
pereira@research.att.com
1-908-582-3980


