I'm using the Qt graphics API to display layers in some GIS software.
Each layer is a group, containing graphic primitives. I have a performance issue when loading fairly large data sets, for example this is what happens when making a group composed of ~96k circular paths (points from a shapefile):
The complete callgrind dump is here.
The QGraphicsScene::createItemGroup()
call takes about 150 seconds to
complete on my 2.4GHz core2, and it seems all this time is used in
QGraphicsItemPrivate::updateEffectiveOpacity()
, which itself consumes
37% of its time calling QGraphicsItem::flags()
4 billion times (the
data comes from a test script with no GUI, just a scene, not even tied
to a view).
All the rest is pretty much instantaneous (creating the items, reading the file, etc...). I tried to disable the scene's index before creating the group and obtained similar results.
What could I do to improve performances in this case ? If I can't is there a way to create groups faster ?