Message passing between threads: Java 4 times faster than D
SeeWebsiteForEmail at erdani.org
Thu Feb 9 09:35:04 PST 2012
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
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).
More information about the Digitalmars-d