Hello, everyone.
Some time ago I found that once in a while Firefox misbehaves in a sense that it eats a lot of cpu and becomes unresponsive.
Constraining it into a cgroup made the system more usable. (
https://www.linuxquestions.org/questions/slackware-14/[testing-needed]-responsiveness-optimizing-cgroups-rc-script-4175655892/), but didn't make Firefox itself as reliable as it used to be.
So I decided to profile the beast, and first I tried it with a recommended by Mozilla Firefox Profiler
http://profiler.firefox.com
It basically showed me that Firefox gets stuck in a tight poll loop, polling for ... what? I didn't see which resource it so desperately wanted. (Perhaps due to the lack of knowledge.)
As a simple solution, I tried to rebuild Firefox parameters different from those provided by the default Slackware, and indeed, after a rebuild, Firefox 60 lost it's tendency to get stuck.
Then the upstream received the newer version 68, and I had to play with parameters a few times again, to find out which combination works for me. It turns out that the following patch to the Slackbuild was needed to get rid of that loop in 68:
Code:
diff --git a/source/xap/mozilla-firefox/mozilla-firefox.SlackBuild b/source/xap/mozilla-firefox/mozilla-firefox.SlackBuild
index 363e2cf7..1d75fa0c 100755
--- a/source/xap/mozilla-firefox/mozilla-firefox.SlackBuild
+++ b/source/xap/mozilla-firefox/mozilla-firefox.SlackBuild
@@ -124,7 +124,7 @@ elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
- SLKCFLAGS="-O2 -fPIC"
+ SLKCFLAGS="-O3 -fPIC"
LIBDIRSUFFIX="64"
elif [ "$ARCH" = "arm" ]; then
SLKCFLAGS="-O2 -march=armv4 -mtune=xscale"
@@ -219,13 +219,10 @@ OPTIONS="\
--enable-default-toolkit=cairo-gtk3 \
--enable-linker=gold \
--enable-startup-notification \
- $GOOGLE_API_KEY \
--enable-strip \
--enable-cpp-rtti \
--enable-accessibility \
--disable-crashreporter \
- --disable-debug-symbols \
- --disable-debug \
--disable-optimize"
# Complains about missing APNG support in Slackware's libpng:
# --with-system-png \
@@ -286,6 +283,7 @@ for option in $OPTIONS; do echo "ac_add_options $option" >> .mozconfig; done
# https://developer.mozilla.org/en-US/docs/Building_with_Profile-Guided_Optimization
# Thanks to ArchLinux and Gentoo for the additional hints.
+PGO=yes
if [ "$PGO" = "yes" ]; then
# Do a PGO build, double time and disk space but worth it.
export MOZ_PGO=1
@@ -293,7 +291,7 @@ if [ "$PGO" = "yes" ]; then
export DISPLAY=:99
# Launch Xvfb to let the profile scripts run in a X session.
# Ugly note: if the build breaks you may want to do a "killall Xvfb".
- Xvfb -nolisten tcp -extension GLX -screen 0 1280x1024x24 $DISPLAY &
+ Xvfb -nolisten tcp -extension GLX -screen 0 1366x768x24 $DISPLAY &
dbus-launch --exit-with-session ./mach build || exit 1
kill $! || true
else
I don't know which one of those five changes unbroke my Firefox:
- -O3
- debug info
- PGO
- Degooglification
- Native Xfvb resolution
I am not really asking anything in this topic, just want to leave this information public on the net for someone who may find it if having a similar problem.
It took roughly 10 hours to rebuild Firefox on my machine, which is Dell Latitude E6420,
2-core, 4-hyper-thread, Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz, 16 Gb RAM.