[MLton-devel] Re: SML Basis review
Matthew Fluet
fluet@cs.cornell.edu
Mon, 18 Aug 2003 14:52:44 -0400 (EDT)
> Concerning the comparison of Imperative vs. Stream I/O input in MLton and
> PolyML, are you saying that
>
> Imperative I/O is faster than Stream I/O
>
> or that
>
> Imperative I/O is no slower than Stream I/O
>
> assuming, of course, the underlying stream is not extracted?
The former: Imperative I/O is faster than Stream I/O, assuming that the
underlying stream is not extracted.
Note that which input function one uses impacts how great the difference.
The extreme example is input1: Under Stream IO, each input generates a
large data structure (relative to the 1 byte that was returned)
corresponding to the stream advanced by one byte. This results in more
allocation time, more GCs, etc. Under the Buffered I (i.e., the special
case of the Imperative IO), we simply update an integer ref corresponding
to the current position in an array of buffered input.
I have a slew of benchmarks that perform a line count on a file using each
of the ImperativeIO and StreamIO input functions, comparing with and
without forcing the underlying stream, and using various implementations.
I could run them again if anyone wants hard numbers.
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel