Skip to content

Excessive allocations in Firebase Trace.incrementMetric #1923

Open
@stari4ek

Description

@stari4ek

[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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions