adobe / adobe/aepsdk-core-android
SQiteDataQueue inefficiently calling DataEntity.toString when trace is disabled
- Dominant language
- Kotlin
- Stars
- 17
- Forks
- 30
- Avg merge
- 8h 37m
- Merged PRs (30d)
- 5
Description
[https://github.com/adobe/aepsdk-core-android/blob/6353dd565267c571297a2b636973738377b921a6/code/cor…](https://github.com/adobe/aepsdk-core-android/blob/6353dd565267c571297a2b636973738377b921a6/code/core/src/phone/java/com/adobe/marketing/mobile/services/SQLiteDataQueue.java#L184)
We noticed a low memory report that referenced this line. It is converting the entity to a `String` even when trace logging is not enabled.
```
Log.trace("Services", this.LOG_PREFIX, String.format("peek - Successfully returned DataEntity (%s)", ((DataEntity)dataEntities.get(0)).toString()), new Object[0]);
return (DataEntity)dataEntities.get(0);
```
In addition the log line seems like it should be able to avoid the manual `toString()` call since `String.format` is being used.
Could it use this function instead to delay the string formatting? `Log.trace(@NonNull String extension, @NonNull String source, @NonNull String format, Object... params)`
Contributor guide
Research direction
Start in code/core/src/phone/java/com/adobe/marketing/mobile/services/SQLiteDataQueue.java around line 184 and compare the existing Log.trace call with the overload that accepts a format string and parameters. Confirm that DataEntity.toString and message formatting are deferred when trace logging is disabled; done means the queue retains its behavior without eagerly converting the entity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev, performance
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100