Qt Weekly #25: Optimization hints on Qt Data Visualization

On Qt Data Visualization 1.1 we introduced a beta level optimization hint QAbstract3DGraph::OptimizationStatic and on 1.2 release the feature is fully supported. On this blog we’ll try to explore this optimization a bit more. We have also been asked how many items you can render on scatter graph. We hope that this blog answers to that question also.

So there are two optimization hints available for the scatter graph; OptimizationDefault and OptimizationStatic. Basically the difference on these hints is that the OptimizationDefault renders each item separately and the OptimizationStatic creates a rendering buffer and uses a single OpenGL call to render the buffer. The advantage on the OptimizationDefault is that it starts the rendering immediately and there’s no latency on getting the graph visible. The drawback on the other hand is numerous OpenGL calls which decrease the performance with large data sets.

The OptimizationStatic uses very few OpenGL calls and renders large data sets quite well. The drawback on this case is that the buffers have to be created before the rendering can start. The biggest factor for the buffer size and for the latency is the amount of vertices on the mesh type. For instance the smooth sphere has 264 vertices compared to cube's 24 vertices, whereas the point has only one vertice. So once the buffer is created it is up to GPU's power to process vertices. The best advice for large data sets is to aim to simple mesh types.

Let's tackle the question about the biggest item count. From the Qt Data Visualization point there's no hard limit for the item count. The ultimate limit comes from your graphics hardware when it just exhausts with the vertices. The question is now how many items you can have and still smoothly rotate and inspect the graph from different angles. Generally the excellent performance rate is considered as 60 FPS, but we can safely say that the usability remains good till 30 FPS.  To find out the limits we set up an application that gradually increased the number of items and measured the performance using QAbstract3DGraph::measureFps property.

The test was run on three different device ranging from embedded device to state of the art desktop PC. For the embedded device we utilized Boot to Qt stack from Qt for Device Creation running on Nexus 7 (device specs: Quad-core 1.2 GHz Cortex-A9 with ULP GeForce). As a laptop we used Lenovo T540p (Intel Core i7-4700MQ CPU 2.40GHz with Intel HD Graphics 4600) using Windows 7. For the desktop PC we chose Asus ROG TYTAN G30AB (Intel Core i7-4770K CPU 3.5GHz with NVIDIA GeForce GTX 780) using Windows 8.1. On the Nexus 7 we used full screen mode and on the PCs 1280 x 1024 pixels area.

Below is presented results of the test. On Boot to Qt powered Nexus 7 you can have around 1600 items with default optimization and still keep the performance on 30 FPS. Meanwhile with the static optimization there can be around 300 thousands of items. On standard desktop with default optimization you can have 18 000 items and still do fine and on static you can go up to 1.8 million of items. With rather powerful GPUs like NVIDIA GeForce GTX 780 using default optimization there can be around to 120 000 items and using static optimization we are talking about 24 millions of items.

results4

Conclusion

The default optimization is ideal if you want to have complex mesh types instantly on the display or you are constantly updating the data. For instance like on the rotations example, where the position and rotation of the arrows are constantly updated. If you have large static data sets, you get a good performance with static optimization. Simpler mesh types like the cube and pyramid performs reasonable well and don't cause a noticeably latency. If you want to have custom mesh types, keep the number of vertices low, around 10-20 vertices. A point type is of course ideal for extremely large data sets. For instance to simulate a galaxy like presented on the example below where we have 105 000 star and dust items and the laptop is doing easily 60 FPS with static optimization.

galaxy2


Blog Topics:

Comments