[Qgis-developer] Vector Layer TranslateFeatures performance (2.8.1 vs 1.8.0)

Pietro Panzeri pietro.panzeri at treuropa.com
Mon Apr 27 01:27:32 PDT 2015


I posted this question also in Qgis BugReports (Bug report #12629) where,
eventually, you can find data for tests.


I developed a plugin for Qgis version 1.8.0 that translates a vector layer
with the simple following code:

delta_x = 0.1
delta_y = 0.3
vlayer = iface.activeLayer()
for fid in range(vlayer.featureCount()):
vlayer.translateFeature(fid, delta_x, delta_y)

then converted for 2.8.1 with the following code:

delta_x = 0.1
delta_y = 0.3
vlayer = iface.activeLayer()
for f in vlayer.getFeatures():
fid = f.id()
vlayer.translateFeature(fid, delta_x, delta_y)

I experience big performance issues in 2.8.1.
Qgis 1.8.0 performs the translation of the attached ShapeFile in about 4
seconds both for the first translation and the following ones.
Qgis 2.8.1 performs the same translation in about 4 minutes for the first
translation and in 20 seconds for the following ones.

The layer loading time is the same for both versions (about 1 second).

I cannot understand the reason of this loss of performance.
I'm available to further test my installations or provide any other data.

The system on which I'm running both Qgis versions is:

Distributor ID: Ubuntu
Description: Ubuntu 12.04.3 LTS
Release: 12.04
Codename: precise

Linux 3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:25:57 UTC 2012 x86_64
x86_64 x86_64 GNU/Linux

Thank you very much.


-- 
Pietro Panzeri

Software Development Manager

Tele-Rilevamento Europa - T.R.E. srl
Ripa di Porta Ticinese, 79
20143 Milano – Italia
Tel.: +39.02.4343.121 - Fax: +39.02.4343.1230
pietro.panzeri at treuropa.com - www.treuropa.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150427/ee7bdb7c/attachment.html>


More information about the Qgis-developer mailing list