I'm currently profiling a Qt app using AMD CodeAnalyst (I have an Intel processor but went for the cheap [$0] profiler). Profiling is time-sample based. The scenario I'm currently investigating involves creating many thousands of QGraphicsItems. Now, I have managed to identify the bottle-necks in the non-Qt code and am at the stage were a lot of time is being spent in QtGui4.dll. I am using Qt 4.7.4. I realize that performance issues with QGraphicsScene have been discussed before, but I could not find any material my profiling issues.

Let me first provide the numbers I'm getting. I will then try to discuss what I think they mean. So a huge amount of time is spent in QtGui4.dll. The time spent in QtGui4.dll is divided as follows:

[61%] operator<<
[25%] QGraphicsItemPrivate::depth
[11%] QGraphicsItemPrivate::childrenClippedToShape
[Remain] <various functions>

I am not sure what "operator<<" means in this context, does any one know?

QGraphicsItemPrivate::depth has to do with the way QGraphicsScene indexes items. I can remove the cost of this function by using QGraphicsScene::setItemIndexMethod(QGraphicsScene: :NoIndex). Even though my scene is mostly static, the view changes a lot, and disabling indexing has a negative impact in the interactivity once the scene is loaded.

I also tried setting QGraphicsScene::setBspTreeDepth() = 1, but it did not speed up the creation of all my items significantly.

So my question is this: I need to load in many thousands of QGraphicsItems (actually QGraphicsObjects) into my QGraphicsScene, how do I do this fast?

Thanks,

T