TextIO.inputN dramatically worse than TextIO.input

Michael Norrish <[email protected]>
Newsgroups gmane.comp.lang.ml.mlton.user
Message-ID <[email protected]>
In the file at


https://github.com/HOL-Theorem-Prover/HOL/blob/40158b75c83806e2901edf0037677582098ec5a3/tools/quote-filter/mlton-quote-filter.sml

there is some code for implementing a simple Unix-style filter, based on some
logic in an mllex lexer (that’s what’s hiding in the structure “filter”).

On lines 13 and 21 I set the lexer up with an input function that is supposed to
return some of the input.  For the interactive version (line 21), using
TextIO.input makes sense because you want to echo (filtered) user input back as
soon as possible.  But in the non-interactive version, I initially thought I’d
use TextIO.inputN.

I was surprised to find that it actually performed 4 times worse on an input
file of size 10MB, taking about 80s instead of 20s.

The fact that either version is taking 20s is pretty painful in itself (a
Poly/ML version of this program does the same input in about 4s).

I’m running on

>    Linux telemachus 3.2.0-75-generic #110-Ubuntu SMP Tue Dec 16 19:11:55 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

with mlton version 20100608.

Should I expect to see this discrepancy?  And what is the point of inputN if so?

Michael

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/

_______________________________________________
MLton-user mailing list
[email protected]; [email protected]
https://lists.sourceforge.net/lists/listinfo/mlton-user
signature.asc (application/pgp-signature, 490 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJU0sipAAoJEGKGQ6ej3R2RSroH/3vXdD91qf7fTCQ6gmecV5yD
8PYQKyBjelgPX3E5jKrDOSme1+WTyEzHs4KGwiADKPo2xzxsjgfi3rogsdFHzGq9
VcFrZscLB1/cEbMnVIgodUuqI4LRHViYvxL1h8/C5DcR9ybs3w5i00X8o2AC9+q+
VZZVqyAVf2uhBKKMB0Ym9BcTCYJYf3HBMWq2N/MpWCgdVOr4CTZlPoVjwWbczj3o
NRbI15BNEkp7hetKlX0TSD1xc/lGXmGCyoAE+3zJzqdj6JRms9y16LwSqqG7x8sy
Mi9jcy8GAY8Ph1g0lJvyO7avnqBID6PWV+LhCWH8OX2VvJdXKCqgOwa+cD9BbAs=
=8Fur
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.