Performance is widely criticized for Qt, especially on embedded or low-end platforms. Therefore, in qt4.5, the first design concept is to improve the runtime performance of QT.
The object code is called Falcon-Falcon. The purpose is to make QT fly. :-)
In fact, performance optimization is the most important and core improvement in qt4.5. The reason is that there are too many improvements, and they are very specific.
. However, on the other hand, developers of the QT application do not need to care about the specific implementation details unless they are interested in the research. The original QT application, you only need to run in the new 4.5
You can feel the performance improvement without modifying the original program code.
So what are the improvements and performance improvements? It mainly consists of three parts: optimization of the Qt graphics engine, hot swapping of the graphics system and performance.
Benchmark tool.
Let's take a look at the optimization of the graph engine of QT itself:
In short, in versions earlier than qt4.5
Engine has some redundancy during qpainter operations. In section 4.5, all the functions that affect global performance have been carefully analyzed and optimized.
For example, qpainter: Begin ()/end (), save ()/restore (),
Drawtextitem (), drawpixmap (). In general, for a widget drawing, the efficiency is improved by nearly 50%. The following figure shows some
Widgets in 4.4 and 4.5 benchmark.
Developer blog here
In addition to the qpaint improvement, the backingstore of 4.5 also has many improvements, including removing many unnecessary qregion operations and being more intelligent.
Update operation.
The following table compares the performance of different update operations of backingstore with transparent and opaque controls.
Operation |
Qt 4.4 |
Qt 4.5 |
Boost |
Full Update (transparent widgets) |
4330 MS |
2446 MS |
1.8x |
Full Update (opaque widgets) |
3352 MS |
1464 MS |
2.3x |
Scroll (opaque widgets) |
50231 MS |
3746 MS |
13.4x |
Partial Update (opaque widgets) |
4246 MS |
1567 MS |
2.7x |
Complex Update (opaque widgets) |
4966 MS |
2265 MS |
2.2x |
Full Update (opaque children) |
3376 MS |
1464 MS |
2.3x |
Move (opaque widgets) |
50293 MS |
4188 MS |
12.0x |
Mass Update (opaque widgets) |
9560 MS |
1679 MS |
5.7x |
Developer blog here
Graphic view is also a major improvement. Before drawing a graphic item, a lot,
Styleoption, intersecting shapes,
Clips pre-judgment, so that when drawing, the speed will be improved. The most intuitive example is that the 4000 chip in qt4.4 can be obtained on average on Windows.
In Linux, The raster engine and graphic built in QT are used.
View, compared to the original X11, the performance can be improved by 5 to 100 times.
Developer blog here
There are also some other minor improvements, as well as non-graphic improvements, such as the use of the drawing engine on the X11 Platform Xshm
(MIT-SHM) to improve the drawing efficiency, and through the qiodevice Class Optimization, improve the file
Io performance increases the loading speed of objects in filedialog.