[Haskell-cafe] Slow IO

jeff p mutjida at gmail.com
Sat Sep 9 20:29:41 EDT 2006


  Try Don Stewart's ByteString library
(http://www.cse.unsw.edu.au/~dons/fps.html). It is much faster than
the standard Haskell IO and now has lazy.


On 9/9/06, Daniel Fischer <daniel.is.fischer at web.de> wrote:
> Hello all,
> Now I have an IO-problem, too.
> SPOJ problem 41 asks basically to determine whether a directed graph allows a
> path that uses every edge exactly once. The data from which the graphs are to
> be constructed are contained in a (huge) file, every item (number of test
> cases, size of test case, edges) on a single line. I've created my own test
> case file (much smaller, but already 217 MB, 2.2 million lines) to check my
> programme's performance. Now profiling reveals that over 90% of time and
> allocation are consumed by reading the file (line by line, reading the whole
> file as a lazy String and then chopping that to pieces is rather worse).
> So how do I quickly
> 1. read an Integer n from the file,
> 2. read the next n lines and
> 3. pass the first and last letter of those to the function that builds and
> checks the graph?
> When that is achieved, I could see whether my algorithm is good.
> Thanks for any help,
> Daniel
> --
> "In My Egotistical Opinion, most people's C programs should be
> indented six feet downward and covered with dirt."
>         -- Blair P. Houghton
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list