firebase / firebase/firebase-android-sdk

Excessive allocations in Firebase Trace.incrementMetric

Open
#1,923 3 comments 0 reactions 0 assignees View on GitHub
api: performance type: feature request
Dominant language
Java
Stars
2.6k
Forks
710
Avg merge
2d 23h
Merged PRs (30d)
34

Description

### [READ] Step 1: Are you in the right place?

yep

### [REQUIRED] Step 2: Describe your environment

* Android Studio version: AS 4.1 RC1
* Firebase Component: Performance
* Component version: 19.0.8

### [REQUIRED] Step 3: Describe the problem

#### Steps to reproduce:

1. Build app with `firebase_performance_logcat_enabled` = `false`
2. Create + start Firebase Trace in the app
3. Use `Trace.incrementMetric()` 1k+ times
4. Observe lots of allocations made by logging inside `Trace.incrementMetric` even when logging is disabled

#### Relevant Code:

Current implementation of successive path in `Trace.incrementMetric`:
```
this.zzai.zzm(String.format(Locale.ENGLISH, "Incrementing metric '%s' to %d on trace '%s'", var1, var5.getCount(), this.name));
```

Every time when metric is increased, there are allocations in `String.format`, `Long.valueOf` for each call, even if logging is disabled (=production/release build)

Since `Firebase Performance` is for performance measuring, no need to add extra excessive overhead

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.