[Haskell-cafe] Example programs with ample use of deepseq?

Johan Tibell johan.tibell at gmail.com
Mon Jan 7 17:12:31 CET 2013

On Mon, Jan 7, 2013 at 4:06 AM, Joachim Breitner
<mail at joachim-breitner.de> wrote:
> I’m wondering if the use of deepseq to avoid unwanted lazyness might be
> a too large hammer in some use cases. Therefore, I’m looking for real
> world programs with ample use of deepseq, and ideally easy ways to test
> performance (so preferably no GUI applications).

I never use deepseq, except when setting up benchmark data where it's
a convenient way to make sure that the data is evaluated before the
benchmark is run.

When removing space leaks you want to avoid creating the thunks in the
first place, not remove them after the fact. Consider a leak caused by
a list of N thunks. Even if you deepseq that list to eventually remove
those thunks, you won't lower your peak memory usage if the list was
materialized at some point.

In addition, by not creating the thunks in the first place you avoid
some allocation costs.

-- Johan

More information about the Haskell-Cafe mailing list