On Wednesday, 1 April 2020 at 06:48:09 UTC, Jacob Carlborg wrote:
I you care about performance you should really compile using
LDC (with `-O5 -release -flto=full
-defaultlib=phobos2-ldc-lto,druntime-ldc-lto`), which usually
produces much better code:
Slice: Mean time(usecs): 50.58, Standard Deviation: 46.2621
Foreach: Mean time(usecs): 53.92, Standard Deviation: 19.8039
For: Mean time(usecs): 39.89, Standard Deviation: 7.80041
Slice: Mean time(usecs): 76.62, Standard Deviation: 73.0014
Foreach: Mean time(usecs): 49.63, Standard Deviation: 24.5672
For: Mean time(usecs): 40.02, Standard Deviation: 7.67388
The benchmark is highly flawed, the results for LDC are
completely meaningless. LDC produces identical code for every
case and the filling procedures are all elided.