[Haskell-cafe] Re: OCaml list sees abysmal Language Shootout results

Peter Simons simons at cryp.to
Thu Oct 7 11:51:22 EDT 2004

Josef Svenningsson writes:

 > What *is* true is that it is difficult to write good
 > performance I/O in any of the *implementations* that we
 > have.

GHC has everything you need to do fast I/O in Haskell. If
you use hGetBufNonBlocking with 'Ptr a', you have
essentially the performance of read(2). That's as fast as it
can be on any given system, in any language.

Even the lazy API is fast enough for pretty much everything
bare the most I/O-intensive applications.

The problem is not Haskell, nor is it the implementation.
The problem is that beginners, including yours truly, tend
to write awfully inefficient code once you give them a
"String" and tell them: Here, that's the contents of your
file. The lazy API hides the fact that I/O takes place, and
it is very tempting to forget that you shouldn't use it like
a random access list. The lazy API "encourages" you to write
inefficient code.

Nonetheless, the problem is the inefficient code, not the

There has been talk about alternative I/O APIs on the list
recently. It would be nice to see something happening on
that front.


More information about the Haskell-Cafe mailing list