Are these bencmarks recent and real?

rempas rempas at tutanota.com
Mon Aug 30 17:30:02 UTC 2021


On Monday, 30 August 2021 at 17:15:00 UTC, Ali Çehreli wrote:
> On 8/30/21 8:46 AM, rikki cattermole wrote:
>
> 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

Yep! There is and I hope things would be more clear. Your book 
helps tho ;)


More information about the Digitalmars-d mailing list