Viewing maps is surely the most common reason why people use a desktop GIS application like QGIS. It’s therefore worth ensuring that the browsing of loaded map layers works as smoothly and as quickly as possible. If we could make map rendering faster, users would be able to spend more time working with the map rather than just waiting for it to be rendered. That would save a lot of time considering QGIS is used daily by thousands of people.
The multi-threaded rendering (MTR) project focussed on two goals:
- Improving the user experience when viewing the map
- Increasing the rendering speed
Work on the MTR project has been completed and was released in QGIS version 2.4
The project was generously funded by:
Improved User Experience
Until QGIS 2.4, each time the user moved the map they would have to wait until the map was completely before the application accepted any further input. This made it difficult to use the map with large datasets: each zoom or move of the map view froze the user interface for several seconds. Also, by default there was no preview of the map while rendering was taking place (enabling preview had various problems and did not work on all platforms).
This project implements a completely new approach to rendering: separating the rendering process, rendering maps in the background so the user is free to perform any action while the map rendering is progressing. It is now possible to zoom or move the map view at any time, so getting to the desired area of interest should be much smoother. Finally, the map preview is continuously updated during rendering, allowing the user to identify areas of interest before seeing the complete map.
In QGIS 2.2 and earlier, the map rendering was always performed sequentially - one map layer after another. Unfortunately this did not leverage the capabilities of modern computers that feature multiple CPU cores. If we wanted to show a timeline of rendering a map with several layers, it would look like this:
The figure above shows two redraws of the map – while one CPU does all the work the others are idle. It is possible to parallelise the rendering and therefore use the other CPUs by employing multiple threads of program execution. Each of the boxes from the figure above can be handled by a different CPU at the same time. Finally all partially rendered map images are composed together. This technique has the potential for speedup proportional to the number of available CPU cores.
In QGIS 2.4 this technique is not enabled by default. To enable it, open the Options dialog, select the Rendering tab and check the Render layers in parallel using many CPU cores option. In future versions of QGIS this mode may be enabled by default.
Please email Martin Dobias for further information on the project.