[Haskell-beginners] Optimising a combinatorial algorithm?

Mario Lang mlang at delysid.org
Thu Sep 24 16:42:32 UTC 2015


Daniel Trstenjak <daniel.trstenjak at gmail.com> writes:

> Hi Mario,
>
> I just took a quick look on the implementation of 'dur'
> and as a first thing I would replace foldl with
> the strict version foldl'.
>
> This already might explain the memory usage.

foldl' helps a bit, but is not the main contributor to the overhead.

Before:
   1,954,532,728 bytes allocated in the heap

After:
   1,741,200,280 bytes allocated in the heap

And runtime is more or less unaffected.

-- 
CYa,
  ⡍⠁⠗⠊⠕


More information about the Beginners mailing list