[MLton] I/O still much slower than C

Henry Cejtin henry@sourcelight.com
Wed, 7 Jan 2004 16:06:35 -0600

One  thing  I  noticed is that the code still seems to do some extra tests on
every character.  I'm looking in fast-imperative-io.fun in the definition  of
input1 (the second definition since the first is never used).  It does a test
of the stream to see if it is a Buffer or Stream.  In general I  would  think
that  this  could  all be in a single interface which always looks at a count
and, if there is room, it just extracts the character.  All other cases would
have  the  count set so that it looks like not enough room, and then the slow
code can do what ever (including EOF, etc.).  Of course all of this is a  bit
of a mess because of the imperative & functional views of streams I guess.

Either way, I am pretty certain that the expense is all in the function call.
I looked to see if there was an easy way to do the hack I did to my  code  to
make all other cases not inline, but haven't gotten it to work yet.