firefox-devtools / firefox-devtools/profiler

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

Open
#5,194 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.5k
Forks
491
Avg merge
3d 46m
Merged PRs (30d)
27

Description

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](https://mozilla-hub.atlassian.net/browse/FP-815)

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.