The*_*ve3 5 java performance android
由于调试原因,我的应用程序中的代码的大多数部分都有这个经常出现的代码部分:
public static final boolean DEBUG = true; // just created once in a "Utility" class
if (Utility.DEBUG)
Log.d("TIMER", /*string message that is strictly related to context*/);
Run Code Online (Sandbox Code Playgroud)
现在,如果布尔值转向false此变为死代码.我的问题是,在这种情况下,Android编译器是否会进行基本优化,例如常量折叠和死代码转移?
如果答案是否定的,那么在发布阶段调试日志的最佳方法是什么?