Help optimizing code?

Adam D. Ruppe destructionator at gmail.com
Mon Jan 1 15:54:33 UTC 2018


On Monday, 1 January 2018 at 15:29:28 UTC, user1234 wrote:
>     dmd mandelbrot.d -O -release -inline -boundscheck=off

-O and -inline are OK, but -release and -boundscheck are harmful 
and shouldn't be used. Yeah, you can squeeze a bit of speed out 
of them, but there's another way to do it - `.ptr` on the 
individual accesses or versioning out unwanted `assert` 
statements - and those avoid major bug and security baggage that 
-release and -boundscheck=off bring.

In this program, I didn't see a major improvement with the 
boundscheck skipping... and in this program, it seems to be 
written without the bugs, but still, I am against that switch on 
principle. It is so so so easy to break things with them.

> - I'd use "double" instead of "real".

On my computer at least, float gave 2x speed compared to double. 
You could try both though and see which works better.


More information about the Digitalmars-d-learn mailing list