I used my own class, which is responsible for logging with the following implementation
public class Logger {
public final static boolean DEBUG = true;
public static void d(String tag, String msg) {
if(DEBUG)
Log.d(tag, msg);
}
}
When I free the application, I set the flag to false, however it was said that the following method is not as efficient as Stringsit is still allocated and then freed in memory
logger used:
Logger.d("tag", "message");
or maybe so by doing this StringBuilderwill be called
Logger.d("tag", "server response: " + response + " timing: " + timing);
It is true that the dalvik / compiler cannot optimize it to prevent this behavior. and if so, is there anything I can do to optimize it, other than moving the if outward?
source
share