benchmark on binary trees

Alex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Dec 4 16:40:21 PST 2015


On Friday, 4 December 2015 at 23:23:37 UTC, anonymous wrote:
>> Why the parallel version is slower then the sequential?
>> If you set
>> int n = 14 in the main function
>> the parallel version is MUCH slower then the sequential. At my 
>> machine
>> 7x slower. Shouldn't it be the other way round?
>
> I don't know what's going on here. You're allocating a lot of 
> `TreeNode`s, though. That's probably not very parallelizable. 
> The GC could also play a role.
>

found and tried out the -vgc option...
Is there a way to deactivate the GC, if it stands in way?

> In this case, I think you're fine. Generally, be aware that D 
> doesn't shine when you create lots of throw-away objects. The 
> GC can't compete with those of C# or Java, so when you 
> translate code from those languages too closely, performance 
> may be worse.

Yes, I thought in the same direction. That's why I tried to 
reimplement the c++ version. The idea was: as I can't compete 
with the GC of C#, I could try to compete by applying another 
approach. I don't try to write something which compete with c++ 
either (I would have to take c++, then? ;) ), but something which 
clearly outperforms the languages with a virtual machine...

tried the -inline option... no time win...


More information about the Digitalmars-d-learn mailing list