Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornell!travelers.mail.cornell.edu!news.kei.com!hookup!olivea!uunet!allegra!ulysses!alice!pereira
From: pereira@alta.research.att.com (Fernando Pereira)
Subject: Re: DCGs
In-Reply-To: joachim@ecrc.de's message of Mon, 14 Nov 1994 10:41:08 GMT
Message-ID: <PEREIRA.94Nov14195115@alta.research.att.com>
Sender: netnews@ulysses.homer.att.com (Shankar Ishwar)
Reply-To: pereira@research.att.com
Organization: AT&T Bell Laboratories
References: <PEREIRA.94Nov10222635@alta.research.att.com> <Cz970K.F94@ecrc.de>
Date: Tue, 15 Nov 1994 00:51:14 GMT
Lines: 31

In article <Cz970K.F94@ecrc.de> joachim@ecrc.de (Joachim Schimpf) writes:
> In article 94Nov10222635@alta.research.att.com, pereira@alta.research.att.com (Fernando Pereira) writes:
> > ...
> >
> >`(C, @(P0,Stream), @(P,Stream)) :-
> >   stream_position(Stream, _, P0),
> >   get0(Stream, C),
> >   stream_position(Stream, P).
> >
> > ...
> >
> >The relative slowness is due to the constant fiddling with stream
> >positions, which involves going through several layers of Prolog, C,
> >I/O libraries and system calls. But using assert to implement some
> >form of streams would be even worse.

> It shouldn't be all that bad when buffered I/O is properly implemented.
> In ECLiPSe, repositioning to a point that is still in the file buffer
> (which should be the case most of the time) just requires moving a
> pointer.
Even if moving within the same buffer you still have to go through the
Prolog->C interface and inside that trhoughs everal layers of function
calls (eg those that check that the motion is within one
buffer). That's far more machine instructions than just moving down a
list. Still worth it, given the alternatives.
--
Fernando Pereira
2D-447, AT&T Bell Laboratories
600 Mountain Ave, PO Box 636
Murray Hill, NJ 07974-0636
pereira@research.att.com
