[MLton] Cygwin->Mingw32: patch + future

Matthew Fluet fluet@cs.cornell.edu
Tue, 23 Nov 2004 08:39:27 -0500 (EST)


> On Mon, Nov 22, 2004 at 07:11:33PM -0500, Matthew Fluet wrote:
> > I think it is an o.k. idea, but if we are doing more work in the
> > basis library, will that slow down TextIO.  Maybe not on Unix, but
> > possibly under Windows.
>
> Certainly TextIO will be slower, but this translation is then not performed
> by the windows 'libc'. The question then becomes what's faster: Windows code
> or MLton code? ;-) (I'll bet Windows code actually, but does it matter?)

That may be, but one would still need to decide where to do the
translation.  You have to understand that there are multiple-levels of
buffers corresponding to each of the IO levels.  Are bytes translated as
soon as they are extracted from the reader?  When they leave a TextIO.f or
TextIO.Stream.f function?  Who tracks the position of the input stream?
What happens when a file-descriptor is lifted to a TextIO.Stream.instream
and a BinIO.instream?  The implementation of {Text,Bin}IO and
{Text,Bin}IO.Stream instreams are very different -- in particular, not
sharing buffers.  So, it is likely that it will be difficult to realize
the idea of _every_ instream derived from the same file-descriptor to be
sharing the same buffer.  And if they aren't sharing the same buffer, then
the interleaving of IO on different streams becomes non-deterministic.