Message passing between threads: Java 4 times faster than D

Nicolae Mihalache xpromache at
Thu Feb 9 03:12:47 PST 2012

That would be funny but it's not true. I tested with different values,
that's why I ended up uploading different versions.

The programs print the computed message rate and takes into account
the number of messages.


On Thu, Feb 9, 2012 at 11:57 AM, Alex_Dovhal <alex_dovhal at> wrote:
> "Nicolae Mihalache" <xpromache at> wrote:
>> Hello,
>> I'm a complete newbie in D and trying to compare with Java. I
>> implemented  a simple test for measuring the throughput in message
>> passing between threads. I see that Java can pass about 4mil
>> messages/sec while D only achieves 1mil/sec. I thought that D should
>> be faster.
>> The messages are simply integers (which are converted to Integer in Java).
>> The two programs are attached. I tried compiling the D version with
>> both dmd and gdc and various optimization flags.
>> mache
> Hi, I downloaded your two programs, I didn't run them but noticed that in
> 'mp.d'
> you have n set to 100_000_000, while in '' n is set to
> 10_000_000, so with this D code is 10/4 = 2.5 times faster :)

More information about the Digitalmars-d mailing list