Parallel Rogue-like benchmark

bearophile bearophileHUGS at lycos.com
Thu Nov 7 06:05:26 PST 2013


Marco Leise:

> foreach (immutable xi; r.x .. r.x + r.w + 1)
>
> What the heck?! I didn't know that even compiles. :)

It's an enhancement that I requested, and Kenji implemented some 
time ago.


> About the UPPERCASE_CONSTANTS: I know we tend to use camelCase
> for them, too. It's just a personal preference to have global
> constants in uppercase.

In C (and In Python, that doesn't enforce their immutability) I 
too write global UPPERCASE_CONSTANTS, but in D module-level 
constants behave better, so I prefer to use the more camelCase.


> If you want it submitted please go ahead.

OK. (I benchmarked it to make sure it's not slower).


> My objection is that
> you condensed the code too much to create a small SLOC in
> comparison to e.g. C++ and moved away from the original coding
> style of the benchmark that made SLOC somewhat comparable.

The style I have used is very similar to my normal style (I add 
few more braces, few more comments, and little more), so I think 
this D code is not unnatural. Most D entries in Rosettacode are 
written in that style.


> Btw. I also wrote a new algorithm for the given problem, that
> gives deterministic "full" levels without resorting to trial
> and error and runs a lot faster (when compiled for 64-bit at
> least):
> http://dpaste.dzfl.pl/d37ba995

I don't know if the author will use that. Nice code and nice 
popcounts.

Bye,
bearophile


More information about the Digitalmars-d mailing list