Array fill performance differences between for, foreach, slice

Adam D. Ruppe destructionator at gmail.com
Wed Apr 1 12:22:48 UTC 2020


On Wednesday, 1 April 2020 at 06:48:09 UTC, Jacob Carlborg wrote:
> You have not enabled optimizations. You should compile with `-O 
> -release -inline` to enable all optimizations.

-release should *never* be used. You're trading memory safety and 
security holes for a few microseconds of execution time. Not 
worth the risk.

For realistic code, try to make it fast without using that 
switch, there's plenty of other ways, like isolated @trusted 
sections as needed. If you have significant cost from asserts you 
might turn them off with `-check=assert=off` to leave them out of 
the compile without affecting the other safety features.

> I you care about performance you should really compile using 
> LDC (with `-O5 -release -flto=full

again forget the -release switch. the rest cool though.


More information about the Digitalmars-d-learn mailing list