The problem with the debug mode is that, for people who never used languages 
compiling to native code, it doesn’t explicitly states that in this mode 
programs will be considerably slower. Many will think that the program will be 
bigger (containing debugging data) which is true indeed, but will not imagine 
how it will be slower.

But I advocate to keep debug mode as default mode as it what we need when 
writing a somewhat complex program. For users accustomed to languages producing 
native code, it is the normal way to proceed: compile in debug mode, then when 
the program is OK, look for optimizations, do some profiling if needed, maybe 
deactivate some checks in parts critical for performance and switch to release 
mode.

But using the release mode as default is also a possibility as it is the normal 
final mode.

As regards the danger mode, well, as its name indicates, it is dangerous. So, 
it should be avoided. For me, producing code which doesn’t contain any code for 
detecting an index out of bounds is a practice from another age.

In fact, I consider that the danger mode is useful for only one thing: compare 
performances with other languages such as C. Of course, checks have a cost and 
in release mode performances are significantly slower, but not that much. And 
rather than deactivate all checks, it is better to deactivate them where the 
gain is important after carefully reviewing the code. 

Reply via email to