[m-dev.] streams in Mercury

Ralph Becket rafe at cs.mu.OZ.AU
Fri Dec 16 12:53:48 AEDT 2005

Julien Fischer, Friday, 16 December 2005:
> > For the MercuryFile the overhead will be one extra pointer lookup to
> > find which underlying C function to call no matter what the underlying
> > stream is.  So very slight.
> >
> It seems somewhat more than very slight here:
> <http://www.cs.mu.oz.au/research/mercury/mailing-lists/mercury-developers/mercury-developers.0008/0099.html>
> but maybe things have changed since then?

Looking at that post, to read and write 1MB of data one byte at a time
took roughly 10 times as much CPU time, but only three times as much
real time, the absolute figures in either case being anyway very small
(and given that this experiment was conducted five years ago, I'd wager
that by now the relative difference in user to real time is tiny).

> No, but depending on the performance impact (if any) it may be good
> reason for not implementing the predicates in the io module in terms
> of the stream typeclasses (as Ian was suggesting).

I'd go the other way and vote for the greater generality of the streams
interface and the s/w engineering benefits of not having special-case
code lying around.  Screaminly high performance IO has not been an issue
for us, just as high performance floating point (on 32 bit
architectures) has not.  If it does become an issue, we know what we
have to do to improve matters.

-- Ralph
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