Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Add support of systrace traces for instance creations #4504

Open
PatilShreyas opened this issue Nov 8, 2024 · 0 comments

Comments

@PatilShreyas
Copy link

It would be nice to have a configurable option to enable system traces for Dagger Android module which will have traces for instance creation to debug performance with DI.

Advantages can be:

  • Can debug the need of making instance @Singleton or not if we see lot of allocations of it (this is anyway possible with memory profiler as well but systrace can give better picture here)
  • Based on these insights, one can decide to use Lazy<> or Provider<> better as per use case needs.
  • Easy performance debugging w.r.t DI

Example:

In this case, LightDependency is a class which is very lightweight to create whereas HeavyDependency might be doing heavy operations while instance creation (it may be 3rd party library instance as well to which we can't add traces as of now)

class LightDependency @Inject constructor(...) {}

class HeavyDependency @Inject constructor(...) {}

class MyClass(private val dependency1: LightDependency, private val dependency2: HeavyDependency) {
  // ...
}

Then systrace can give picture like this:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant