retard wrote:
Granted, even if logging is disabled, the compiler will push the
arguments on the stack and call logInfo().
This is a case where a JIT compiler wins. The code runs equally fast
without the call at all and with logging turned off (dynamically). In
languages like D, the like has to be statically turned off unless
compilers have any new dynamic optimizations.
Can the JIT really do this optimization? It sounds as if it'd detect
that the variable never changes, and generate code with that fixed value.