firefox-devtools / profiler

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

Profiling sources of JS garbage no longer works? #4663

Open juj opened 1 year ago

juj commented 1 year ago

Hi,

I am trying to use Firefox Profiler to benchmark code lines that allocate JS garbage. To do that, I enable the option "JS Allocations" in the profiler and do a run of the page that does allocations.

However, when I view the profile, there are no allocations recorded: https://share.firefox.dev/3oYdAto

I wonder if the feature might have regressed?

In the past I recall the capture sampling was probabilistic, and defaulted to capturing 5% of all JS allocations. There was a pref I would set to up the rate to capturing all 100% allocations. Is that probabilistic capturing still a thing? I am benchmarking a WebAssembly page, and it might be possible that there aren't that many JS allocations overall (and the intent is that since it is wasm, there shouldn't practically be almost any, hence I am profiling to see JS call sites where there would be allocations)

┆Issue is synchronized with this Jira Task

mstange commented 1 year ago

In that profile you also have the nostacksampling feature set. That's probably why the allocations don't have stacks.

The UI could probably do a better job of pointing out conflicting features.

juj commented 1 year ago

Ohhh, thanks! I thought I would disable it since I was not looking to do any time based sampling. I indeed see that it works now with that restored. Got https://share.firefox.dev/3NqXDVK now with stack sampling restored.

Do you know if this mode should capture 100% of all JS allocations, or is it still probabilistic?

mstange commented 1 year ago

I believe it is still probabilistic. @gregtatum might know more.

juj commented 1 year ago

I vaguely remember some years ago my workflow used to be to navigate to about:config, then search for word probability and then change the pref that popped up from 0.05 to 1.0 to make sure I would catch all the allocations. Though now when I try, I don't find any pref that would match with that name. I wonder if the profiler might now be hardcoded to take only a fraction of all allocations...?