Hacker's guide to WebKit/GTK+

Optimization

Little work has yet been done to optimize the GTK+ port so there's plenty of low-hanging fruit. There's a "Performance" tag in the bug tracker which should be used for performance-related bugs.

Dependencies

WebKit/GTK+ performance characteristics are highly dependent on the platform environment:

  • Recent versions of Cairo are essential for good performance. Was developed tracking Cairo git head.
  • X server configuration: Does the device have accelerated blitting, scaling or more?

Tools

Speculation

Graphics

  • There is no back-buffer -- everything is redrawn on every scroll. It's actually kind of impressive that the browser is still usable despite all the needless re-drawing.
  • All image rendering is done client-side rather than being uploaded to the X server. Not great, but not a big issue (and maybe even a small win) on devices without good hardware acceleration eg. N800.

SVG

  • Many mallocs that could be done on the stack.
  • Patterns being re-constructed for each use rather than being cached.
  • Hit-testing slowness. Was discussed on the Cairo list around Nov '07. Gecko guys are tracking this one too.

Canvas

  • Lots of going back-and-forth between system and video memory from what I can tell. Could do something smarter here.

CURL http

  • Suspicions that we are blocking the main thread too long here. Some kind of main loop integration (code is readily available for this, glibcurl) will help, but should probably be integrated only after the existing code is cleaned up.
  • http cache: There is none.

Image decoders

  • Potential for memory reductions (TODO: add bug# here)

Comparative

Nokia internet tablets

This applies to perf testing on the N770, N800 and N810.

Test the browser as displayed normally (ie. not full screen, not minimised).

I run tests with no applications other than a single xterm in the background.

Power saving:

  • Disable power saving to avoid CPU/tick scaling after a period of inactivity
    • Control panel -> Display -> Display stays lit: When charging
    • Keep it plugged in

If benchmarking Gecko-based browsers like MicroB:

  • Go to about:config, set dom.max_script_run_time to 0