Are these bencmarks recent and real?

Ali Çehreli acehreli at yahoo.com
Mon Aug 30 17:15:00 UTC 2021


On 8/30/21 8:46 AM, rikki cattermole wrote:
> 
> On 31/08/2021 3:34 AM, jfondren wrote:
>> That D can compile amazingly fast can be shown just by building dmd 
>> itself.
> 
> "Oh let me recompile dmd" - Stefan
> 
> A little gag from this BeerConf and yeah, it builds fast.

The following program takes 10 seconds on my computer. How is that fast? :p

import std.range;
import std.algorithm;

int main() {
   enum ret = 4_000_000.iota.sum;
   // pragma(msg, ret);
   return ret ^ ret;
}

(Of course I am joking: Replacing 'enum' with e.g. 'const' makes it fast.)

However, TIL: pragma(msg) works with 'const' variables! (At least with 
that one.) Replace 'enum' with 'const' and pragma(msg) computes it at 
compile time. But... but... 'const' doesn't really mean compile-time... 
Is that intended? There is some semantic confusion there. :/

Ali


More information about the Digitalmars-d mailing list