Mozilla plans to introduce Off-Main-Thread painting in the next stable version of the Firefox browser to improve the browser's performance significantly.

Basically, what Mozilla did was move rasterization to its own thread. When Firefox renders a web page, certain activities happen in the background.

Three of the four, making a display list, assigning layers and rasterization, happen in the main thread, while compositing happens in a separate thread.

Mozilla's solution to improve performance records commands for rasterization in the main thread, but sends these recorded commands to the new paint thread where the rasterization happens. From there, data is sent to the compositor thread.

The cost of rasterization depends on a number of factors including the display resolution. Rasterization is more expensive the higher the monitor resolution is, about ten times on a 4K screen when compared to a 1024x768 screen according to Mozilla.

The effect that Off-Main-Thread painting has on Firefox's performance is significant. Mozilla measures performance by analyzing how much time rasterization requires.

In Firefox 57, rasterization that used less than 10% of the paint cycle occurred 51% of the time. Off-Main-Thread painting improved that figure to 80% in Firefox 58.

Rasterization costs used 50% or more of a paint cycle 21% of the time in Firefox 57. With Off-Main-Thread painting enabled in Firefox 58, that figure dropped to just 4%.

Mozilla created a benchmark to measure performance in frames per second. The benchmark simulates a heavy workload scenario by "spending 14ms of each frame spinning the CPU on JavaScript, and then forcing the browser to re-render a complex SVG pattern".

The FPS improved in the benchmark by 30% with Direct2D and by 25% with Skia in Firefox 58 when compared to Firefox 57.

Mozilla plans to improve Off-Main-Thread painting further. The organization's engineers have set their sight on parallel painting for instance, and on resolving some of the outstanding issues, for instance that Firefox does not support "rasterizing 'mask' layers on the paint thread" currently.

You find additional -- technical -- information on Off-Main-Thread painting on the Mozilla GFX blog.

Will users notice the improvement? It depends on their system, and what they do on the Internet.

Summary Article Name Firefox 58: Off-Main-Thread painting promises performance improvements Description Mozilla plans to introduce Off-Main-Thread painting in the next stable version of the Firefox browser to improve the browser's performance significantly. Author Martin Brinkmann Publisher Ghacks Technology News Logo

Advertisement