[Qgis-developer] SpatiaLite very slow with QGIS 1.7

a.furieri at lqt.it a.furieri at lqt.it
Sun Mar 20 13:50:01 EDT 2011


On Sun, 20 Mar 2011 12:01:48 +0000, Giovanni Manghi wrote
> can this be the reason why the user find qgis trunk generally slower
> than 1.6?
> 

I've finally been able to identify the actual reason causing 
QGIS 1.7.0 to be intolerably slow when quitting or opening any
project containing several tenths (or hundredths) layers.

Here are timings I've measured *before* applying any patch:
project loading / map canvas update: 54 seconds
exiting from QGIS: 110 seconds

and the following ones are timings measured *after* patching:
project loading / map canvas update: 3 seconds
exiting from QGIS: instant

--------------

I've prepared a full-scale test DB (and related QGIS project):
http://www.gaia-gis.it/merano.7z 
- 18MB (compressed)
- 110+ layers
- about 100,000 total features
(may well be you need to manually adjust the QGIS project file
so to arrange paths accordingly to your specific test platform).

Timings reported above were actually measured using this sample.

-------------

Post Mortem analysis:

each time QGIS 1.7.0 adds (or removes) a single layer, an
attempt is performed in order to update the MapCanvas (and
related toolery).
So, when adding (or removing) several layers at the same
time, the following actions are actually performed:

step #1: adding the layer #1, updating the MapCanvas
         (containing 1 layer)
step #2: adding the layer #2, updating the MapCanvas
         (containing 2 layers)
step #3: adding the layer #3, updating the MapCanvas
         (containing 3 layers)
.........
step #50: adding the layer #50, updating the MapCanvas
         (containing 50 layers)
.........
step #100: adding the layer #100, updating the MapCanvas
         (containing 100 layers)
.......... and so on .............

this fully explains why the time required to open some project
grows exponentially as the total number of layers increases.

my "experimental" patch simply defers actual MapLayers insertion
(or deletion), so to perform a single massive operation instead
of many distinct 'atomic' operations.

-----------------

Please Note Well: I'll *not* commit my "experimental" patch to the SVN;
my own understanding of QGIS MapCanvas (and related) is really
rudimentary and approximative :-)

I suppose some other developer can design a much more
effective and elegant patch: anyway, just for studying
purposes, you'll find my SVN DIFF here:
http://www.gaia-gis.it/svn-diff-patch.zip

bye Sandro




More information about the Qgis-developer mailing list