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

Abbreviate method names to show most relevant info based on available space #5194

Open
nisargjhaveri opened this issue Nov 7, 2024 · 0 comments

Comments

@nisargjhaveri
Copy link
Contributor

nisargjhaveri commented Nov 7, 2024

In some languages, the method name can be very long when namespaces and class names are included. .e.g. com.example.mypackage.myclass.methodName in java or exampleNamespace::className::method in c++

In the Flame Graph and Stack Chart, often there is not enough space for the entire name to show up, and we end up showing just the start of the name. More often than not, most interesting part is on the later part of the name while most frames might have same or similar namespace and classnames making it difficult to glance through and make sense of the profile without either zooming a lot or having a look at the tooltip for each of the frame. The classname and namespaces are also important preventing just keeping the method name in the profile always.

Android Studio profiler handles this interestingly, and I think something like that can help a lot. It abbreviates the names only when there is not enough space giving preference to the later chunks of the name. For example, depending on the available space for the method name, it can take one of the following forms.

com.example.mypackage.myclass.methodName -> c.example.mypackage.myclass.methodName -> c.e.mypackage.myclass.methodName -> c.e.m.myclass.methodName -> c.e.m.m.methodName -> methodName

This helps a lot as it prioritises the most important important, while also showing more information as and when possible.

In Firefox Profiler currently, we simply end up adding ellipses at the end. e.g. com.example.mypac... which is much less useful than c.e.m.m.methodName for an example.

I believe this would help in Firefox Profiler as well, by improving the effectiveness of the Flame Graph and Stack Charts. Can we implement something like this? How should we go about this?

┆Issue is synchronized with this Jira Task

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