Message passing between threads: Java 4 times faster than D

Marco Leise Marco.Leise at gmx.de
Thu Feb 9 10:31:58 PST 2012


Am 09.02.2012, 18:35 Uhr, schrieb Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org>:

> On 2/9/12 6:10 AM, Gor Gyolchanyan wrote:
>> Generally, D's message passing is implemented in quite easy-to-use
>> way, but far from being fast.
>> I dislike the Variant structure, because it adds a huge overhead. I'd
>> rather have a templated message passing system with type-safe message
>> queue, so no Variant is necessary.
>> In specific cases Messages can be polymorphic objects. This will be
>> way faster, then Variant.
>
> cc Sean Kelly
>
> I haven't looked at the implementation, but one possible liability is  
> that large messages don't fit in a Variant and must use dynamic  
> allocation under the wraps. There are a number of ways to avoid that,  
> such as parallel arrays (one array per type for data and one for the  
> additional tags).
>
> We must make the message passing subsystem to not use any memory  
> allocation in the quiescent state. If we're doing one allocation per  
> message passed, that might explain the 4x performance difference (I have  
> no trouble figuring Java's allocator is this much faster than D's).
>
>
> Andrei

Well, what does +1 Variant and +1 LinkedListNode sum up to?


More information about the Digitalmars-d mailing list