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

Ertugrul Söylemez es at ertes.de
Tue Jan 8 15:39:30 CET 2013


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’ll try to find out, by runtime observerations, which of the calls ot
> deepseq could be replaced by id, seq, or „shallow seqs“ that, for
> example, calls seq on the elements of a tuple.

Now that you know when /not/ to use deepseq, let me tell you when it's
appropriate: parallelization via parallel strategies.  It's not exactly
necessary to use deepseq (or rdeepseq in this case), but it's often very
easy to express your algorithms in the usual way and then just change
some of the 'map' applications to 'parMap rdeepseq'.

When your algorithm is written with parallelization in mind this often
gives you an amazingly parallel program by changing only a few words in
your source code.


Greets,
Ertugrul

-- 
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130108/8df398b3/attachment.pgp>


More information about the Haskell-Cafe mailing list