I would like to optimize the dml-code I have for speed in a production environment. As far as I understand log
statements such as:
log info, <n>: <string>;
Get translated in at least one if statement in the executable, because there is a need to check whether the log-level
is larger than n.
I would like to avoid that by throwing the if statement out of the executable similar to #define
and #ifdef
statements in C and the only way I found in dml is by defining a constant and checking it and hoping the compiler will optimize out the code, recognizing it will never be executed.
constant LOG = 1; // there is not even the possibility to define a bool constant
if (LOG) log info, <n>: <string>;
My questions are:
- Is there a better (more efficient, more elegant) way to implement that?
- Will the dml-compiler or the C-compiler optimize the code out?
- How can I verify the code is no longer in the executable (or in the intermediate C source) ?
Thanks in advance.