Idiomatic way of writing nested loops?

Russel Winder via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 18 08:18:58 PDT 2017


On Tue, 2017-07-18 at 08:41 +0000, Anton Fediushin via Digitalmars-d-learn
wrote:
> On Tuesday, 18 July 2017 at 03:36:04 UTC, Nicholas Wilson wrote:
> > With regards to parallel, only use it on the outermost loop. 
> > Assuming you have more items in the outermost loop than you do 
> > threads parallelising more than one loop won't net you any 
> > speed.
> 
> Thank you! Yes, `parallel` runs only 4 threads on my machine, so 
> there is no reason to use it in nested loops.

But how many processors, cache sizes, memory speed, etc, etc, etc. The only
way of knowing what the fastest performance is is to try some things and get
some performance data. Even then the result only applies to that data on
that computer.

This is the sort of situation where philosophising about performance often
ends up with totally the wrong 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: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20170718/9ce2797a/attachment.sig>


More information about the Digitalmars-d-learn mailing list