firefox-devtools / profiler

Firefox Profiler — Web app for Firefox performance analysis
https://profiler.firefox.com
Mozilla Public License 2.0
1.14k stars 373 forks source link

Ignore webextensions functions #4449

Open julienw opened 1 year ago

julienw commented 1 year ago

Moved from https://bugzilla.mozilla.org/show_bug.cgi?id=1810084:

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0

Steps to reproduce:

I opened the devtools on my website (which is more a webapp than a site, as it relies heavily on JS and DOM updates) then the profiler with the "Webdevelopment" parameter. Then in the tracks I unselect everything that is not my website (parent, screenshots, others tabs or iframes).

I want to focus on what I can fix to improve the performances, meaning on the code I own, not webextensions or devtools.

I take a look at the flame chart mainly then the stacks.

Actual results:

In the flame chart, "resource://gre/modules/Timer.sys.mjs" takes 5.1% of the time. The MutationCallback around 2% (Lastpass, KeepInTab, uBlock origin extensions)…

This is an example and the values can vary and be higher.

To ignore those (I want to focus on my code) I ignore them through click + "D" or right-click -> ignore samples with this function.

In the call tree they (webextensions, not devtools) are also easy to spot sicne they a little puzzle icon.

Expected results:

If there was either a parameter before the recording, or a button after to filter all the extensions and devtools resources, it would be great and improve my experience a lot.

cc nicofrand

┆Issue is synchronized with this Jira Task

julienw commented 1 year ago

@nicofrand by chance, do you have a profile link with such an issue that you could share here?

nicofrand commented 1 year ago

I hope that won't give too much private inforrmation… But here it is: https://profiler.firefox.com/public/78jc82ej956hk4c0hpvzc9hatwm1gnzpmzg5par/flame-graph/?globalTrackOrder=xowxr0wxn&hiddenGlobalTracks=0wxmxowxr&hiddenLocalTracksByPid=520992-02wb~928353-01~521185-0~521089-0~542999-0~661721-0~929047-0~521635-0~919846-0~521124-0~927499-0~521637-0~661649-0~928782-0~521175-0~521165-0~667396-0~920760-0~897309-0~871713-0~870046-0~894512-0~524042-0~892165-0~521653-0~669051-0~542896-0~733465-0~543941-0~548483-0~927074-0~521157-01~681461-0~895012-0~524110-0~928855-0~717128-0~892294-0~668112-0~884408-0~521109-01~718344-0~896141-0~521148-01~681634-01~715129-0~928683-01~653791-01~521382-0w2~705554-0w2~716713-01~524203-0w2~521487-0w3~521151-0w3&implementation=js&thread=yi&v=8

image

nicofrand commented 1 year ago

Percentage taken by extensions/devtools vary of course, but in the example above the 3.4% from Lastpass are 3.4% I cannot optimize (thus 3.4% I don't really care).

julienw commented 1 year ago

Thanks!

I wanted to check the behavior using the active tab view, an experimental view that's better tailored for web developer. You can enable it by adding &view=active-tab to the url. It's also enabled by default on Nightly with using the Web Developer preset.

With this view, the extension stuff disappears, but the devtools stuff is still present.

pinging @canova who knows the active tab view inner workings better than me :) what do you think Nazim?

nicofrand commented 1 year ago

That seems nice! Is there anyway to hide the screenshots though (I don't use them when profiling JS)?

nicofrand commented 1 year ago

Also, the extensions are not hidden everywhere:

image