Running Phobos unit tests in threads: I have data

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Sat May 3 14:14:28 PDT 2014


>>     if(single) {
>>         foreach(test; tests) {
>>             test();
>>         }
>>     } else {
>>         foreach(test; tests.parallel) {
>
> Try different batch size:
> test.parallel(1), test.parallel(2) etc.

So as to not have thread creation be disproportionately 
represented, I repeated the module list over and over again, 
making the number of tests run equal to 9990. This takes 5s on my 
machine to run in on thread and 12s in multiple. Here are the 
things I tried:

1. Created my own TaskPool so I could decide how many threads to 
use
2. Changed the batch size in parallel from 1 to 10 to 100 to 1000
3. Explicitly spawn two threads and tell each to do a foreach on 
half of the tests


None of them made it go any faster. I had similar results using 
unit-threaded on my own projects. This is weird.

Atila


More information about the Digitalmars-d mailing list