Parallel Rogue-like benchmark

bearophile bearophileHUGS at lycos.com
Fri Nov 8 00:10:58 PST 2013


logicchains:

> Benchmark author here. I left the ldmd2 entry there to 
> represent the performance of the D implementation from the time 
> of the benchmark, to highlight that the current D 
> implementation is much newer than the others, and that there 
> have been no attempts to optimise the C and C++ versions 
> similarly to how the latest D version was optimised. If you 
> feel it creates needless confusion I can remove it, however, or 
> put a note next to it stating the above.

ldmd2 is not a compiler, it's just a thin wrapper that helps use 
the ldc2 compiler with the same command line options of dmd. So I 
think putting two entries for ldc2 and ldmd2 is a little 
confusing for D newbies, it looks like they are two different 
compilers (also because their performance appears different in 
the table).

I have just written an answer in your good blog to solve the 
small problem you have found in my code. Here is a better 
explanation. If you have code like:

uint[10] data;
foreach (i, ref x; data)
     x = i;

This code works on 32 bit systems, because the index i of an 
array is deduced as a size_t. So it fits inside the array of 
uints. On a 64 system i is still size_t, but it's now 64 bit 
long, and it can't fit. Most integral values (like int and uint) 
in D have a fixed size. While size_t is not fixed in size.

This causes some problems when you want to move 32 bit code to a 
64 bit system.

Some times ago I opened an enhancement request on this topic, but 
perhaps better solutions are needed:
https://d.puremagic.com/issues/show_bug.cgi?id=5063

And the solution suggested by Walter here is not enough:
> auto i = array.length;

It's not a big problem, such mistakes usually don't cause 
significant problems, and sometimes the attempt to avoid the 
problem is worse than the the problem itself.

Bye,
bearophile


More information about the Digitalmars-d mailing list