New issue
Advanced search Search tips

Issue 694303 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Apr 2018
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Implement a presubmit to ban string concatenation in Java log statements

Project Member Reported by torne@chromium.org, Feb 20 2017

Issue description

org.chromium.base.Log methods support printf-style formatting, specifically to avoid doing unnecessary string concatentation, but many callsites don't use it and still just concatenate the string at the callsite. Proguard can't eliminate this code, even when inside Log.d() - it doesn't realise that the StringBuilder calls have no useful effect, so we end up building the entire string even for debug logging that's never printed at all.

We should maybe have a presubmit script that bans this, as it will reduce binary size a bit. We should probably also ban android.util.Log as this doesn't have the same features and is still used in some cases.
 
Labels: Performance-Size
Status: Fixed (was: Untriaged)
The PRESUBMIT check has been added.
Would you mind posting the CL link for cross reference? Thanks!
From a git blame, looks like the main ones were:
aa68d5ec85d3d
87d9fb6e6ca1f
38736db9311bb

Sign in to add a comment