How to debug slowness

Users and developers helping users with generic and technical Pale Moon issues on all operating systems.

Moderator: trava90

Forum rules
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
xtal256
Moon lover
Moon lover
Posts: 95
Joined: 2014-06-22, 00:32
Location: here

How to debug slowness

Unread post by xtal256 » 2024-05-15, 00:21

For a long time I have experienced slowness and hangs after using the browser for a while, with the only fix being to restart the browser. This happens most often when watching videos on YouTube, with me having to restart it a few times a week. Other websites are not as bad, but I can't really have more than 10-12 tabs open at once before things start to slow down and eventually force me to restart. If I don't pre-emptively restart then certain operations like loading a site will hang for a few minutes or indefinitely.

The unfortunate reality is that software is becoming more bloated and almost all websites (even the simplest ones) suffer from this. However, I don't accept that the browser should get slower and hang due to this and think that it instead might be a misbehaving add-in with a memory leak or something.
The problem is that I have no tools to debug this. Viewing the stack trace in something like Process Explorer or Process Hacker (now called System Informer) gives me a high level overview of what the code is doing but just tells me that it's in the JavaScript engine or xul.dll.
Is there any sort of logging I can turn on? Some way of profiling the JavaScript that the browser itself is running. There used to be a way of opening the dev tools on the browser chrome but I can't find that option any more (or maybe I am just thinking of DOM Inspector).

Operating system: Windows 10 64-bit
System specs: Intel i7-8700K (12 core), 64GB RAM
Browser version: 33.1.0
32-bit or 64-bit browser? 32 bit
Browser theme (if not default): My own custom theme
Installed add-ons:
  • Adblock Latitude 5.0.9
  • Clear Search 2 1.1.2
  • DOM Inspector 3.1.7534
  • Download Manager (S3) 4.13
  • Forecastfox (fix version) 2.4.8
  • ImageTweak 0.25.1.2
  • JSONovich 1.9.7.1.2
  • keyconfig 20110522
  • LastPass 3.3.4
  • lori (Life-of-request info) 0.2.0.20080521.2
  • Markdown Viewer 1.12
  • Menu Wizard 5.05
  • Organize Status Bar 0.6.5
  • Pale Moon Commander 3.0.1
  • Stylish 2.0.7
  • Tab Mix Plus 0.5.8.4
  • Tab Scope 1.6.1.2
  • Windowify Manager Pages 2.0
  • Greasemonkey 1.15 (disabled)
  • Web Developer 1.2.11 (disabled)
Installed plugins:
  • Microsoft Office (File: NPSPWRAP.DLL)
  • Silverlight Plug-In (File: npctrl.dll)
  • Microsoft Office (File: npMeetingJoinPluginOC.dll)
All of the above plugins are disabled.

Important prefs:
  • accessibility.typeaheadfind = true
  • accessibility.typeaheadfind.flashBar = 0
  • browser.cache.compression_level = 1
  • browser.cache.disk.capacity = 204800
  • browser.cache.disk.filesystem_reported = 1
  • browser.cache.disk.smart_size_cached_value = 358400
  • browser.cache.disk.smart_size.enabled = false
  • browser.cache.disk.smart_size.first_run = false
  • browser.cache.disk.smart_size.use_old_max = false
  • browser.cache.memory.enable = false
  • browser.display.background_color = #C0C0C0
  • browser.display.use_system_colors = true
  • browser.download.importedFromSqlite = true
  • browser.download.manager.showAlertOnComplete = false
  • browser.download.manager.showWhenStarting = false
  • browser.fixup.alternate.enabled = false
  • browser.places.importBookmarksHTML = false
  • browser.places.importDefaults = false
  • browser.places.leftPaneFolderId = -1
  • browser.places.migratePostDataAnnotations = false
  • browser.places.smartBookmarksVersion = 4
  • browser.places.updateRecentTagsUri = false
  • browser.privatebrowsing.dont_prompt_on_enter = true
  • browser.search.openintab = true
  • browser.search.suggest.enabled = false
  • browser.search.update = false
  • browser.search.useDBForOrder = true
  • browser.sessionstore.restore_on_demand = false
  • browser.startup.homepage = https://www.google.com.au
  • browser.startup.homepage_override.buildID = 20240419202341
  • browser.startup.homepage_override.mstone = 6.6.0
  • browser.tabs.agePerSeconds = 1
  • browser.tabs.agingAmount2 = 5
  • browser.tabs.closeWindowWithLastTab = false
  • browser.tabs.highlightActiveTab = false
  • browser.tabs.selectOwnerOnClose = false
  • browser.tabs.warnOnClose = false
  • browser.urlbar.autoFill = false
  • browser.urlbar.formatting.enabled = false
  • browser.urlbar.matchBehavior = 2
  • browser.urlbar.maxRichResults = 7
  • dom.max_script_run_time = 0
  • dom.mozApps.used = true
  • extensions.lastAppVersion = 33.1.0
  • font.default.x-western = sans-serif
  • font.internaluseonly.changed = false
  • general.useragent.extra.microsoftdotnet = (.NET CLR 3.5.30729)
  • general.useragent.updates.lastupdated = 1715717513824
  • gfx.blacklist.suggested-driver-version = 257.21
  • gfx.crash-guard.d3d11layers.appVersion = 33.1.0
  • gfx.crash-guard.d3d11layers.deviceID =
  • gfx.crash-guard.d3d11layers.driverVersion =
  • gfx.crash-guard.d3d11layers.feature-d2d = false
  • gfx.crash-guard.d3d11layers.feature-d3d11 = false
  • gfx.crash-guard.status.d3d11layers = 2
  • gfx.crash-guard.status.d3d11video = 2
  • gfx.direct3d.last_used_feature_level_idx = 0
  • gfx.font_rendering.cleartype_params.force_gdi_classic_max_size = 7
  • gfx.font_rendering.cleartype.always_use_for_content = true
  • gfx.font_rendering.cleartype.use_for_downloadable_fonts = true
  • media.benchmark.vp9.fps = 302
  • media.benchmark.vp9.versioncheck = 3
  • media.gmp.storage.version.observed = 1
  • media.hardware-video-decoding.failed = false
  • network.cookie.prefsMigrated = true
  • network.enableIDN = false
  • network.http.max-persistent-connections-per-server = 8
  • places.database.lastMaintenance = 1715566029
  • places.history.expiration.transient_current_max_pages = 126118
  • plugin.disable_full_page_plugin_for_types = application/vnd.fdf
  • plugin.importedState = true
  • plugin.state.flash = 0
  • plugin.state.java = 0
  • plugin.state.np-vmware-vmrc = 0
  • plugin.state.npadobeaamdetect = 0
  • plugin.state.npauthz = 0
  • plugin.state.npctrl = 0
  • plugin.state.npdeployjava = 0
  • plugin.state.npfoxitreaderplugin = 0
  • plugin.state.npgoogleupdate = 0
  • plugin.state.npican = 0
  • plugin.state.npintelwebapiipt = 0
  • plugin.state.npintelwebapiupdater = 0
  • plugin.state.npmeetingjoinpluginoc = 0
  • plugin.state.npnv3dv = 0
  • plugin.state.npnv3dvstreaming = 0
  • plugin.state.npspwrap = 0
  • plugin.state.npurlinterceptorplugin = 0
  • privacy.clearOnShutdown.cookies = false
  • privacy.clearOnShutdown.downloads = false
  • privacy.clearOnShutdown.formdata = false
  • privacy.clearOnShutdown.history = false
  • privacy.clearOnShutdown.offlineApps = true
  • privacy.clearOnShutdown.sessions = false
  • privacy.cpd.cookies = false
  • privacy.cpd.downloads = false
  • privacy.cpd.extensions-tabmix = false
  • privacy.cpd.formdata = false
  • privacy.cpd.history = false
  • privacy.cpd.offlineApps = true
  • privacy.cpd.sessions = false
  • privacy.donottrackheader.value = 1
  • privacy.GPCheader.enabled = true
  • privacy.sanitize.migrateFx3Prefs = true
  • privacy.sanitize.timeSpan = 0
  • security.dialog_enable_delay = 0
  • security.disable_button.openCertManager = false
  • security.disable_button.openDeviceManager = false
  • security.OCSP.disable_button.managecrl = false
  • security.tls.version.min = 2
  • security.warn_viewing_mixed = false
  • services.sync.declinedEngines =
  • services.sync.engine.greasemonkey = false
  • storage.vacuum.last.index = 1
  • storage.vacuum.last.places.sqlite = 1715047621
  • ui.osk.debug.keyboardDisplayReason = IKPOS: Touch screen not found.
Last edited by xtal256 on 2024-05-15, 06:13, edited 1 time in total.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5603
Joined: 2015-12-09, 15:45

Re: How to debug slowness

Unread post by moonbat » 2024-05-15, 01:32

Might need more RAM than the 4 GB hard limit that a 32 bit system imposes. Also it's better to create separate threads for individual slow websites (after searching to see if there's already similar threads) in the web compatibility board. A general 'everything is slow' query isn't going to be easy to troubleshoot.
If you're running 64-bit Windows 10 and have more than 4 GB of RAM and don't particularly need 32-bit plugins (the only reason to ever run a 32 bit browser build on a 64 bit OS), then consider changing to the 64 bit version of Pale Moon. It won't affect anything else on your profile or settings.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX
Jabber: moonbat@hot-chili.net

xtal256
Moon lover
Moon lover
Posts: 95
Joined: 2014-06-22, 00:32
Location: here

Re: How to debug slowness

Unread post by xtal256 » 2024-05-15, 03:14

I'll have to remember to check how much RAM it uses next time it gets slow. I know memory does grow, though I don't recall it ever hitting the 4GB limit.

But if that is the case then it suggests a memory leak. If it's in the core C++ code then that would be something for the Pale Moon devs to investigate, but if it's JavaScript that is eating up all the memory (say, because it is creating many new objects without allowing the old ones to be freed) then it is something I could investigate myself if I had the right tools.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5603
Joined: 2015-12-09, 15:45

Re: How to debug slowness

Unread post by moonbat » 2024-05-15, 03:46

You still haven't mentioned how much physical RAM you have and the bitness of your OS.
xtal256 wrote:
2024-05-15, 03:14
But if that is the case then it suggests a memory leak
Use the browser on your regular websites (again, which ones?) using a fresh new profile to rule out any problems with your addons or settings first.
And reminder -
moonbat wrote:
2024-05-15, 01:32
Also it's better to create separate threads for individual slow websites (after searching to see if there's already similar threads) in the web compatibility board.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX
Jabber: moonbat@hot-chili.net

xtal256
Moon lover
Moon lover
Posts: 95
Joined: 2014-06-22, 00:32
Location: here

Re: How to debug slowness

Unread post by xtal256 » 2024-05-15, 06:19

moonbat wrote:
2024-05-15, 03:46
You still haven't mentioned how much physical RAM you have and the bitness of your OS.
Oh, sorry. I updated the info in my original post.

I'm starting to notice some slowness now and browser memory hasn't gone above 2GB. I see a lot of spikes in CPU usage though. I imagine that is due to some of the tabs I have open polling the server for updates.
moonbat wrote:better to create separate threads for individual slow websites
Ah I just realised what you meant. I thought you were talking about CPU threads, and I thought that there was nothing I can do about that as I don't work on the Pale Moon code :)
I could create a thread about YouTube being slow, but plenty of people have already done that. My question is more specifically about how I can investigate it myself instead of constantly complaining that "Pale Moon is broken!"

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 5603
Joined: 2015-12-09, 15:45

Re: How to debug slowness

Unread post by moonbat » 2024-05-15, 06:34

xtal256 wrote:
2024-05-15, 06:19
My question is more specifically about how I can investigate it myself instead of constantly complaining that "Pale Moon is broken!"
First thing about troubleshooting is to rule out any problems due to your extensions or settings changes - for this create a separate fresh profile for testing from the about:profiles page, and run your problematic website on that. If you still see broken functionality or slowness on a fresh profile, it means there's a problem with the site (especially if reported by others as well), or something else with your browser/hardware setup.
If the site runs fine on a fresh profile, then it could be a problem with your extensions; you'll have to disable them one by one and restart after each round to see which one may be causing it. If you're using ancient Firefox extensions, those may not work properly. There may be similar ones on the Pale Moon addons site that are better compatible and currently maintained.

In fact the best thing to do is to test a broken website on a fresh profile beforehand and report the results when asking for help to save yourself and everyone else time spent in troubleshooting :)
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
KDE Neon on a Slimbook Excalibur (Ryzen 7 8845HS, 64 GB RAM)
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX
Jabber: moonbat@hot-chili.net

Goodydino
Keeps coming back
Keeps coming back
Posts: 905
Joined: 2017-10-10, 21:20

Re: How to debug slowness

Unread post by Goodydino » 2024-05-15, 17:31

If you clear your cache and history frequently, you should find that the browser is more responsive. If the browser has to stop and clear out the oldest items to make room for the newest, that slows it down. Also, why leave the browser running all the time? You cannot browse 24 hours a day, so why not shut the browser down when you need to sleep, at least?

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 37756
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: How to debug slowness

Unread post by Moonchild » 2024-05-15, 18:04

Depending on which sites you visit, leaving the browser up 24/7 can have it lose performance due to complex websites leaving "cruft" (that's a technical term) behind after tabs are closed - you can thank document-detached web specifications for that little gem. This can lead to so-called "ghost windows" which can cause issues for the garbage collector as it is not clear if this cruft can be cleaned up or not. If you experience slowness next time, go to about:memory, do a measure, and see if there are any "ghost windows" - drill down a bit if there are to see which website(s) caused it; that's one part of how you can debug general slowness.
"A dead end street is a place to turn around and go into a new direction" - Anonymous
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

xtal256
Moon lover
Moon lover
Posts: 95
Joined: 2014-06-22, 00:32
Location: here

Re: How to debug slowness

Unread post by xtal256 » 2024-05-16, 00:46

Thanks Moonchild, I'll try that.

dapgo
Fanatic
Fanatic
Posts: 235
Joined: 2016-10-11, 11:36

Re: How to debug slowness

Unread post by dapgo » 2024-05-31, 09:20

Moonchild wrote:
2024-05-15, 18:04
Depending on which sites you visit, leaving the browser up 24/7 can have it lose performance due to complex websites leaving "cruft" (that's a technical term) behind after tabs are closed - you can thank document-detached web specifications for that little gem. This can lead to so-called "ghost windows" which can cause issues for the garbage collector as it is not clear if this cruft can be cleaned up or not. If you experience slowness next time, go to about:memory, do a measure, and see if there are any "ghost windows" - drill down a bit if there are to see which website(s) caused it; that's one part of how you can debug general slowness.
Recently my palemoon was very slow, checked memory (about:memory) and it was using 2GB, and sites using more memory were ghosts( one was instagram).

I clicked on "minimize memory usage" button but nothing got improved and the ghost sites stay there.
So, I closed Palemoon, then there is no palemoon on screen or task bar
Then I executed PM but it says that PM is open already, and prompt to close it, i clicked on "close" and PM is using only 800MB of memory :)

From long time ago I fix my performance and memory issues with the "Minimize memory usage" and i was used to work fine.

User avatar
suzyne
Astronaut
Astronaut
Posts: 736
Joined: 2023-06-28, 22:43
Location: Australia

Re: How to debug slowness

Unread post by suzyne » 2024-05-31, 10:33

dapgo wrote:
2024-05-31, 09:20
I clicked on "minimize memory usage" button...
I have used about:memory before for the measurements, but somehow had not noticed the Minimize memory usage button. That surprises me, but now I know it's there, it looks quite useful!

About the ghost windows, or any site that is slowing down Pale Moon too much, I have found that using the File, Restart command after closing the offending tab is most effective.
Laptop 1: Windows 11 64-bit, i7 @ 2.80GHz, 16GB, NVIDIA GeForce MX450.
Laptop 2: Windows 10 32-bit, Atom Z3735F @ 1.33GHz, 2GB, Intel HD Graphics.
Laptop 3: Linux Mint 20.3 64-bit, i5 @ 2.5GHz, 8GB, Intel HD Graphics 620.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 37756
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: How to debug slowness

Unread post by Moonchild » 2024-05-31, 11:04

dapgo wrote:
2024-05-31, 09:20
I clicked on "minimize memory usage" button but nothing got improved and the ghost sites stay there.
"Minimize memory usage" only does something for normal situations. Ghost windows are not normal situations as the browser had already been unable to clear the memory when the site was closed with the normal cleanup processes available. By definition it cannot touch ghost windows.
Only a browser (close and) restart can solve this at the moment. I've been looking at options to clean up ghost windows.
dapgo wrote:
2024-05-31, 09:20
So, I closed Palemoon, then there is no palemoon on screen or task bar
Then I executed PM but it says that PM is open already, and prompt to close it, i clicked on "close"
When Pale Moon closes down it does its best to cleanly remove all of its allocations and memory. if ghost windows exist this often fails and then it can take a long time for the browser process (still running after the browser windows have been closed) to actually shut down, which is why you got that message and the option to forcefully close it (which is fine to do in that case).
"A dead end street is a place to turn around and go into a new direction" - Anonymous
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

KlarkKentThe3rd
Astronaut
Astronaut
Posts: 584
Joined: 2018-04-20, 20:31

Re: How to debug slowness

Unread post by KlarkKentThe3rd » 2024-05-31, 12:26

I just learned about ghost windows. Things are VERY slowly starting to make sense.

dapgo
Fanatic
Fanatic
Posts: 235
Joined: 2016-10-11, 11:36

Re: How to debug slowness

Unread post by dapgo » 2024-05-31, 13:07

Moonchild wrote:
2024-05-31, 11:04
dapgo wrote:
2024-05-31, 09:20
I clicked on "minimize memory usage" button but nothing got improved and the ghost sites stay there.
"Minimize memory usage" only does something for normal situations. Ghost windows are not normal situations as the browser had already been unable to clear the memory when the site was closed with the normal cleanup processes available. By definition it cannot touch ghost windows.
Only a browser (close and) restart can solve this at the moment. I've been looking at options to clean up ghost windows.
dapgo wrote:
2024-05-31, 09:20
So, I closed Palemoon, then there is no palemoon on screen or task bar
Then I executed PM but it says that PM is open already, and prompt to close it, i clicked on "close"
When Pale Moon closes down it does its best to cleanly remove all of its allocations and memory. if ghost windows exist this often fails and then it can take a long time for the browser process (still running after the browser windows have been closed) to actually shut down, which is why you got that message and the option to forcefully close it (which is fine to do in that case).
IMO, if PM can detect the lack of performance or ghosts, just notifying the user about it and suggesting a restart can be very appreciated by many users. I suppose that most users would never do an about:memory

And a more sophisticated solution would be even better :thumbup:

User avatar
tristan9
Hobby Astronomer
Hobby Astronomer
Posts: 28
Joined: 2023-06-08, 09:29

Re: How to debug slowness

Unread post by tristan9 » 2024-06-01, 13:02

Moonchild wrote:
2024-05-31, 11:04
Only a browser (close and) restart can solve this at the moment. I've been looking at options to clean up ghost windows.
Out of curiosity, what kind of "cruft" are we talking about here? Things like mutation/resize observers?

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 37756
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: How to debug slowness

Unread post by Moonchild » 2024-06-01, 13:26

tristan9 wrote:
2024-06-01, 13:02
Out of curiosity, what kind of "cruft" are we talking about here? Things like mutation/resize observers?
You have to think more of much larger structures that can't reasonably be traced by the garbage collector, i.e. shadow trees, DOM/JS structures with loaded-in modules, but also combined with observers as you suspect because those would create links to keep stuff "alive". It's no coincidence that Chrome started its multi-process "let's throw everything out" journey around the same time as WebComponents became a thing. It just avoids these issues because these issues can't survive a terminated application process (hence "restart" being the only real solution for us at the moment)
"A dead end street is a place to turn around and go into a new direction" - Anonymous
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
tristan9
Hobby Astronomer
Hobby Astronomer
Posts: 28
Joined: 2023-06-08, 09:29

Re: How to debug slowness

Unread post by tristan9 » 2024-06-01, 13:32

Moonchild wrote:
2024-06-01, 13:26
You have to think more of much larger structures that can't reasonably be traced by the garbage collector, i.e. shadow trees, DOM/JS structures with loaded-in modules, but also combined with observers as you suspect because those would create links to keep stuff "alive".
I suppose that makes sense, and with SPAs there's no easy point where the entire thing can be trashed all at once either... Tricky to make sure nothing ever leaks anything anywhere in practice...

User avatar
UCyborg
Lunatic
Lunatic
Posts: 377
Joined: 2019-01-10, 09:37
Location: Slovenia

Re: How to debug slowness

Unread post by UCyborg » 2024-06-01, 20:05

YouTube causes constant full utilization of one CPU core very soon, which persists after closing the tab. I wonder what goes on in there, when you scroll down the comments, CPU usage stops on Firefox, but on Pale Moon, it will persist forever until you restart.

Maybe the ability for suspending inactive tabs would be nice to have as an alternative to slower unloading. Maybe that could tame the ghost windows, at least on the CPU side.

Off-topic:
I also wonder if Piped could be get to cache at least shorter videos completely in memory. It's a much lighter alternative front-end to YouTube with setting for enabled codecs among other things, but you can't have something set on a loop without it constantly re-downloading.

Potkeny
Fanatic
Fanatic
Posts: 151
Joined: 2018-08-03, 17:00

Re: How to debug slowness

Unread post by Potkeny » 2024-06-01, 20:45

UCyborg wrote:
2024-06-01, 20:05
Maybe the ability for suspending inactive tabs would be nice to have as an alternative to slower unloading. Maybe that could tame the ghost windows, at least on the CPU side.
You can try that with https://addons.palemoon.org/addon/suspender/

User avatar
UCyborg
Lunatic
Lunatic
Posts: 377
Joined: 2019-01-10, 09:37
Location: Slovenia

Re: How to debug slowness

Unread post by UCyborg » 2024-06-01, 21:56

That unloads it, I meant something in the style of Edge's sleeping tabs. They wouldn't need to be reloaded when switching back to a sleeping tab. So a bit like suspending the browser process, just on a tab basis.