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

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Aug 8 22:58:01 AEST 2000


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.

> Will we get similar slow downs for a typeclass based approach, or will
> type class specialisation remove most of the overhead?

If type class specialization and cross-module optimization are enabled
and do their job properly, then they ought to be able to eliminate all
of the overhead.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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