Thursday 17 January 2008

Firefox/Mozilla performance under linux/Xorg

Today I've had enough of some sites being slow under Linux and Firefox. The particular site at this occasion was business.hr. The machine in question is a 3.4 GHz Pentium 4 with a Radeon X300, running the open source "ati" driver (this one loads the actual "radeon" driver). The Linux on the machine is a Debian unstable running xorg core ver. 1.4.1~git20080105-1 and ati ver. 6.7.197-1. I've tried running current git Xorg and drivers, but while I was happy to have it compile, it segfaulted (log file attached bellow).

The site was just awfully, painfully, slide show like slow when scrolling the page. Latest nightly build of Firefox 3 didn't help. My colleague had a ubuntu 7.10 laptop with intel graphics board that worked like a charm on that page. Fortunately we had another laptop with ubuntu 7.04 with intel that exhibited the same problem as my X300 machine. So I decided upgrading it to 7.10 to see if it will go away. I did that and enabled bling (compiz). The problem went away on the newly upgraded laptop.

I figured that enabling compiz on the desktop machine could help. So I've found instructions. Compiz didn't work (gtk-window-decorator didn't draw any window decorations). But the business.hr site scrolling got fast! It turns out that the Option "XAANoOffscreenPixmaps" "true" was the key. I made profiles using sysprof.

The slow one (Firefox 2):


The slow one (Firefox 3):


The fast one:



We spent 81% of the CPU time in X server in the slow case and 40% of the time in the fast case.

I wanted to test another scenario with graphics so I found this site . Even with the naughty XAAOffScreen pixmaps off, it was jerky under Firefox 2, and worked much more smoothly under Windows Firefox 2. So I was delighted to find that Firefox 3 made it smooth under Linux too. Hooray for Linux! Wanting to see if the Firefox 3 was faster still under Windows, I was amused to find that Firefox 3 was jerky there now. Still, under the best case scenario for both systems (ffox 2 on win32, and ffox3 on linux), Windows seemed better CPU usage wise (35% vs 60% CPU usage).


There is clearly more room for optimizations, but it seems quite nice now with Firefox 3 and the XAA stuff fixed. In addition to this quirk, with intel driver on the current Xorg git working nice only when EXA is disabled with Option "AccelMethod" "XAA", Linux distribution vendors certainly must be careful with how they will tune their Xorg configs and patch their drivers.


UPDATE:

Option "AccelMethod" "EXA" also seems to work for the X300, without having to do a Option "XAANoOffscreenPixmaps" "true", which makes sense because XAA and EXA are different acceleration paths. But I'm not sure about the accross the board performance and stability of EXA on the X300. I'll make a new post when I make the tests.

Here's a snippet of the profile with EXA:



UPDATE 2

The addition of the Option "XAANoOffscreenPixmaps" "true" also helps with the intel hardware I have. Be sure not to use EXA on the intel because it also makes things really slow for now. Maybe EXA will be fixed some day, but currently it's better not to use it on intel.

Here are additional links and files.

sysprof:
business-xaaNOoffscreenpixmaps.sysprof.bz2 (fast)
business-xaaoffscreenpixmaps.sysprof.bz2 (slow)
business-ffox3.sysprof.bz2 (slow)

cube-firefox2.0.bz2 (slow)
cube-firefox3.0.bz2 (fast)

business-exaX300.sysprof.bz2 (fast)


Crashing Xorg GIT:
xlog.log

Bug report on the freedesktop bugzilla:
https://bugs.freedesktop.org/show_bug.cgi?id=12069

5 comments:

  1. However disabling offscreen-pixmaps means software rendering only, which may be a short-time solution but not acceptable for a long time (who needs 2d accalerators if they are completly unused?).

    Best would be to write intel, ati, nvidia, ... to enhance their XRender implementation.

    ReplyDelete
  2. I wrote to the xorg mailing list, there is a bug report, so that part is done.

    Since this makes things faster for everybody, and doesn't disable other acceleration paths that actually work, I'm quite happy with this.

    ReplyDelete
  3. JiMMy: hi been trying to post this on
    nvidia, firefox, fedora forum but all
    requires bloody registering, signup...
    So far, found a couple of blog sites without registering ...

    Firefox slow scrolling fixed?
    -----------------------------

    Using out-of-the-box Xorg’s “nv” driver, Firefox has really slow or sluggish scrolling on certain websites (http://www.firingsquad.com/) rendering this world-class-browser almost useless.

    I cannot blame the driver as both Opera & Konqueror browsers work just fine (QT & GTK issue?). Yet, I cannot blame the browser as changing to Vesa or Nvidia’s driver, fixed the problem.

    Here are the workarounds:

    ***Vesa - monitor’s refresh rate is fixed at 60 Hz (headaches).

    ***Nvidia - manual installation (recompiling or missing dev. tools on liveCD) but provide other goodies (OpenGL)

    ***Nv - Enable ShadowFB option seems to fixed it but I think this option is deprecated? I really hope not, because I have not find other workarounds for this out-of-the-box driver (If anyone knows, please reply).

    I don’t know why they (Xorg, Fedora or Ubuntu) don’t just enable this option by default because browsing the internet is one of the main activities for majority of users on a computer (after games, SETI, etc. rolleyes). Crippling this world-class-browser certainly will hamper Linux’s adoption for newcomers who relie on out-of-the-box drivers

    Section “Device”
    Identifier “Videocard0″
    Driver “nv”
    Option “ShadowFB” “true”
    EndSection

    I do not know if this problem affects ATi users but I am sure you can find a similar workaround and post it for all.

    ReplyDelete
  4. Great post. I was checking constantly this blog and I am impressed!
    Very helpful info specifically the last part :) I care for such info a
    lot. I was looking for this particular information for a long time.
    Thank you and good luck. If you are facing problem with your Mozilla Firefox support, You can reach Acetecsupport at their Toll Free No +1-800-231-4635 For US/CA.

    ReplyDelete