I dun a DIP, possibly the best DIP ever

Walter Bright newshound2 at digitalmars.com
Sat Apr 25 10:21:54 UTC 2020


On 4/25/2020 3:06 AM, Stefan Koch wrote:
> template Add3(alias y)
> {
>      enum Add3 = y + 3;
> }
> 
> enum x = staticMap!(Add3,
> AliasSeq!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 
> 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 
> 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, /*goes 
> towards 4096*/); // this line was abbreviated.
> );
> pragma(msg, x.length + x[$-1]);
> 
> dmd fresh from walters branch release build with ldmd(ldc) 1.20
> time:
> 0m0.230s
> time for a fresh dmd build under the same condtions with that patch reverted:
> 0m0.265s
> time for doing it with our "..." patch:
> 0.030s
> 
> these numbers are just a best out of 3 messurement so please only see them as a 
> rough guide.

Thank you. Though I don't see how the ... thing would speed up AliasSeq, it 
would speed up the staticMap.


More information about the Digitalmars-d mailing list