Bug report #20065
QgsInterface::adddockwidget slows down when large layers open
|Affected QGIS version:||3.2.3||Regression?:||No|
|Operating System:||Windows 10||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||27887|
Having opened a larger vector layer, reloading a plugin using PluginReloader is slower in QGIS 3.2.x than in QGIS 2.18.x (tested with 3.2.3 and 2.18.23, but presumably consistend over other versions).
Using cProfile, if found out its not the plugin itself but its call of QgsInterface::addDockWidget that causes the delay. Closing and re-opening the plugin dockwidget shows the same delay behaviour.
On QGIS 3, addDockWidget takes 5s - 20s, depending on the size of the vector layer and the location of storage (its slower with a layer from a remote network drive). Without any layer opened, its just as fast as normal. My plugin, obviously, contains some QgsMapLayerComboBoxes. Somwhere in the call of addDockWidget there must be a time-expensive call onto the layers that are to be shown in the comboboxes.