Default initialization of static array faster than void initialization

kinke noone at nowhere.com
Fri Nov 8 17:49:54 UTC 2019


On Friday, 8 November 2019 at 16:49:37 UTC, wolframw wrote:
> I compiled with dmd -O -inline -release -noboundscheck 
> -mcpu=avx2 and ran the tests with the m array being 
> default-initialized in one run and void-initialized in another 
> run.
> The results:
> Default-initialized: 245 ms, 495 μs, and 2 hnsecs
> Void-initialized: 324 ms, 697 μs, and 2 hnsecs

If you care about performance, you're much better off with LDC or 
GDC. DMD v2.089 takes 11.7 ms on my Win64 machine, LDC (`ldc2 -O 
-run gist.d`) v1.18 0.27 ms - that's 43x faster.



More information about the Digitalmars-d-learn mailing list