[Haskell-cafe] Slow IO?

Steve stevech1097 at yahoo.com.au
Mon Aug 31 14:40:19 EDT 2009

On Sun, 2009-08-30 at 18:50 +0400, Eugene Kirpichov wrote:
> Thanks :) I wonder why SPOJ didn't accept the same thing from me.
> I think that in order to obtain even higher performance we need to
> resort to low-level IO: raw reading into a byte buffer and parsing the
> very buffer to avoid memcpy'ing.
> Or, better, to use Oleg's iteratees with a file handle enumerator.
> I'll probably give it a try when I have time, but there's a 70% chance
> that I won't, so someone please try it, it should work :)

I just discovered that the SPOJ question regarding the problem
had already been asked about 2 years ago.

Donald Stewart gave a solution - long, complex and highly optimised
using knowledge of Data.ByteString internals. But fast - 2 or 3 times as
fast as your method.


More information about the Haskell-Cafe mailing list