[Haskell-beginners] Help with slow algorithm

Diego Echeverri diegoeche at gmail.com
Sat May 15 12:27:49 EDT 2010


Thanks!

I checked Brandon's link and it was indeed wasting too much time doing
GC (80%-70%). I did profiling by type and most of it were lists. I'm
only using lists in the addOne function when I get the elements of the
array. Maybe it would help to create the ByteArray directly without
using that intermediate list (No idea how to do it). Or it would be
even better if I could just use something like "mutable bytestrings"
That would avoid some of the packing and unpacking.

Even when I managed to make it pass. I feel like cheating. Instead of
changing it algorithmically I changed some of the GC options to avoid
GC time. In order to do this I followed this:
http://www.haskell.org/haskellwiki/SPOJ

In case anybody is interested, here's the code:

http://gist.github.com/402282



On Sat, May 15, 2010 at 2:57 AM, Daniel Fischer
<daniel.is.fischer at web.de> wrote:
> Congrats.
> But you should try to squeeze a little more out of it.
>
> Cheers,
> Daniel
>



-- 
Att: Diego Echeverri Saldarriaga


More information about the Beginners mailing list