On Monday, 1 January 2018 at 15:54:33 UTC, Adam D. Ruppe wrote:
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.

If you use .ptr then you get zero detection, even in debug builds.

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.

In this program, it's relatively small and doesn't look like it does its calculations in realtime. I'd rather there be a potential bug than the program running to slow to be usable, or have zero debugging for indices in debug builds.




Reply via email to