DMD 1.034 and 2.018 releases

renoX renosky at free.fr
Sun Sep 7 13:12:11 PDT 2008


Christopher Wright a écrit :
> bearophile wrote:
>> Walter Bright:
>>> Can you make it faster?
>>
>> Lot of people today have 2 (or even 4 cores), the order of the 
>> computation of those ops is arbitrary, so a major (nearly linear, 
>> hopefully) speedup will probably come as soon all the cores are used. 
>> This job splitting is probably an advantage even then the ops aren't 
>> computed by asm code.
> 
> The overhead of creating a new thread for this would be significant.


Well for this kind of scheme, you wouldn't start a new set of thread 
each time! Just start a set of worker threads (one per cpu pinned to 
each cpu) which are created at startup of the program, and do nothing 
until they are woken up when there is an operation which can be 
accelerated through parallelism.

> You'd probably be better off using a regular loop for arrays that are 
> not huge.

Sure, even with pre-created threads, using several cpu induce additional 
cost at startup and end cost so this would be worthwhile only with loops 
'big enough'..

A pitfall also is to ensure that two cpu don't write to the same cache 
line, otherwise this 'false sharing' will reduce the performance.

renoX


More information about the Digitalmars-d-announce mailing list