[m-dev.] for review: change MercuryFile structure

Peter Ross peter.ross at miscrit.be
Tue Aug 8 23:04:16 AEST 2000


On Tue, Aug 08, 2000 at 10:58:01PM +1000, Fergus Henderson wrote:
> On 08-Aug-2000, Peter Ross <peter.ross at miscrit.be> wrote:
> > On Tue, Aug 08, 2000 at 03:31:12PM +1000, Fergus Henderson wrote:
> > > On 28-Jul-2000, Peter Ross <peter.ross at miscrit.be> wrote:
> > > > Change the MercuryFile structure so that it now contains pointers to
> > > > functions which operate on the MercuryFile.  This allows us, for
> > > > example, to create a MercuryFile structure which operates on sockets and
> > > > use the predicates in io.m to operate on the socket stream.
> > > 
> > > OK, so this change is another version of the one previously
> > > discussed in the thread "Add Mission Critical extensions".
> > > Unlike the previous version, in this version the changes
> > > are applied unconditionally, rather than being #ifdef'd.
> > > 
> > > The main drawback of that is the possible performance
> > > implications.  What's the performance impact of this change?
> > > For example, how much does this change slow down `cat'
> > > programs written using io__read_char or io__read_line_as_string?
> > > I don't think we should commit this change until we have
> > > measured the performance impact.  If the performance impact
> > > is too high, then we should go with the conditional compilation
> > > approach.
> > > 
> > I ran the following command under WinNT a number of times and took the
> > best time.  INPUT was about 1Mb in size.
> > 
> > cat < INPUT > OUTPUT
> > 
> > Original version:
> > real    0m0.062s
> > user    0m0.015s
> > sys     0m0.031s
> > 
> > New Version:
> > real    0m0.171s
> > user    0m0.140s
> > sys     0m0.061s
> 
> Hmm, that's nearly a factor of three slowdown overall,
> and nearly a factor of ten slowdown in user time.
> I think that is a too much to have this change enabled by default,
> at least in the absence of a compelling compensatory feature.
> 
It does make providing new IO modules extremely easy, for instance I
plan to port the MC sockets library.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list