[Haskell-cafe] Slow IO

Udo Stenzel u.stenzel at web.de
Wed Sep 13 05:07:40 EDT 2006


Daniel Fischer wrote:
> > Most certainly not.  I'm pretty sure this is to a bug in your code.
> > Something retains a data structure which is actually unneeded.  Probably
> 
> Apparently. And my money is on a load of lines from the file (of which I need 
> only the first and last Char).

Then you're doing it wrong[TM].  You shouldn't need to keep any part of
the input in memory.  Whatever it is, nobody can tell you without seeing
the code.  Try heap profiling, should you have no idea where to look for
leaks.


> How could I solve the problem without representing the graph in some way?

By using an advanced tool called "brains".  Sorry for not being more
specific, but that's actually the fun part of the challenge and I'm not
going to spoil it for you.  ;-)


> Forgive the stupid question, but where if not RAM would the chunk currently 
> processed reside?

Oh, I overlooked "chunk".  Well, yes, the "chunk" currently processed
needs to fit into RAM.  But how much of a problem could a single Char
pose?


Donald Bruce Stewart wrote:
> I agree. Some problems simply require you to hold large strings in
> memory. And for those, [Char] conks out around 5-10M (try reversing a
> 10M [Char]).

Sure, this one just isn't of that kind.


Udo.
-- 
"Irrationality is the square root of all evil"
                -- Douglas Hofstadter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20060913/5c1436d4/attachment.bin


More information about the Haskell-Cafe mailing list