Running Phobos unit tests in threads: I have data

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


gdc gave _very_ different results. I had to use different modules 
because at some point tests started failing, but with gdc the 
threaded version runs ~3x faster.

On my own unit-threaded benchmarks, running the UTs for Cerealed 
over and over again was only slightly slower with threads than 
without. With dmd the threaded version was nearly 3x slower.

Atila

On Saturday, 3 May 2014 at 21:14:29 UTC, Atila Neves wrote:
>>>    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