map! filter! and range algorithm

Russel Winder russel at winder.org.uk
Tue Mar 5 09:19:10 PST 2013


On Mon, 2013-03-04 at 12:24 -0800, H. S. Teoh wrote:
[…]
> > Is there a way to "parallelize" this kind of operations?
> 
> What do you mean by "parallelize"? Run in multiple threads? I don't
> think you can do that, because the result of filter depends on what it
> gets from map.

This shows the deficiency in thinking of explicit use of threads as the
only way forward. filter → map is a classic pipeline and if processed
using a stream model over a thread pool using work stealing leads to
code that is good. Alternatively do a parallel filter followed by a
parallel map, data paralleism over a thread pool, more good code.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130305/c900b8e0/attachment.pgp>


More information about the Digitalmars-d-learn mailing list