<div dir="ltr">Debuggin pointed me to the problem: a lot of EMPTY GEOMETRYCOLLECTIONS caused QgsVectorFileWriter to write a lot of log messages. Commenting line 1718 [1] made the process run to the end in linear time.<div>
<br></div><div>Wouldn't be nice having an option (from the GUI) to disable logging?</div><div><br></div><div>giovanni<br><div><br></div><div>[1] <a href="https://github.com/qgis/QGIS/blob/master/src/core/qgsvectorfilewriter.cpp#L1718">https://github.com/qgis/QGIS/blob/master/src/core/qgsvectorfilewriter.cpp#L1718</a></div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-01 22:57 GMT+02:00 G. Allegri <span dir="ltr"><<a href="mailto:giohappy@gmail.com" target="_blank">giohappy@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Just two graphics two show a brutal benchmark (measuring time in every cycle step).<div><br></div><div>Clip: <a href="http://cdn.img42.com/31e0205c1273a1d1c705e5109da48db1.png" target="_blank">http://cdn.img42.com/31e0205c1273a1d1c705e5109da48db1.png</a></div>

<div>Difference: <a href="http://cdn.img42.com/eeba68e62ea7d4db50662c2745a6d912.png" target="_blank">http://cdn.img42.com/eeba68e62ea7d4db50662c2745a6d912.png</a></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
2014-07-01 20:05 GMT+02:00 G. Allegri <span dir="ltr"><<a href="mailto:giohappy@gmail.com" target="_blank">giohappy@gmail.com</a>></span>:<div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">To be correct, the two postgis queries are:<div><br></div><div><div>select min(l.osm_id),st_difference(l.geom,st_union(e.geom)) as geom from linee_selezione_s l join edifici_buffer_s e</div>

<div>on ST_Intersects(l.geom, e.geom) group by l.geom</div>
</div><div><br></div><div><div>select min(l.osm_id),st_intersection(l.geom,st_union(e.geom)) as geom from linee_selezione_s l join edifici_buffer_s e</div><div>on ST_Intersects(l.geom, e.geom) group by l.geom</div></div>

</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-01 19:37 GMT+02:00 G. Allegri <span dir="ltr"><<a href="mailto:giohappy@gmail.com" target="_blank">giohappy@gmail.com</a>></span>:<div><div>
<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I'm doing some tests on fTools/Processing spatial operators, with a cover multilinestring layer and a base polygon layer.<div><br></div><div>Running the following query on PostGIS I get similar timings with st_intersection and st_difference:</div>



<div><br></div><div><div>select l.osm_id,ST_intersection(l.geom,e.geom) as geom from linee_selezione as l,edifici_buffer as e where ST_Intersects(l.geom, e.geom)</div><div><br></div><div>while if I run the Difference tool QGIS chokes and it takes magnitudes of more time then Clip.</div>



<div>If made both tools as similar as possible, just changing this [1] line of code, but the difference in execution time remains big.</div><div><br></div><div>I can't find out where is the difference, because both PostGIS and QGIS base the operations on GEOS.</div>



<div>Any hints?</div><div><br></div><div>giovanni</div><div><br></div><div>[1] <a href="https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/qgis/ftools/Clip.py#L107" target="_blank">https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/qgis/ftools/Clip.py#L107</a></div>


<span><font color="#888888">
<div><br></div>-- <br><div dir="ltr">Giovanni Allegri<br><a href="http://about.me/giovanniallegri" target="_blank">http://about.me/giovanniallegri</a><div>Twitter: <a href="https://twitter.com/_giohappy_" target="_blank">https://twitter.com/_giohappy_</a></div>



<div>blog: <a href="http://blog.spaziogis.it" target="_blank">http://blog.spaziogis.it</a><br>GEO+ geomatica in Italia <a href="http://bit.ly/GEOplus" target="_blank">http://bit.ly/GEOplus</a></div></div>
</font></span></div></div>
</blockquote></div></div></div><div><div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Giovanni Allegri<br><a href="http://about.me/giovanniallegri" target="_blank">http://about.me/giovanniallegri</a><div>
Twitter: <a href="https://twitter.com/_giohappy_" target="_blank">https://twitter.com/_giohappy_</a></div>
<div>blog: <a href="http://blog.spaziogis.it" target="_blank">http://blog.spaziogis.it</a><br>GEO+ geomatica in Italia <a href="http://bit.ly/GEOplus" target="_blank">http://bit.ly/GEOplus</a></div></div>
</div></div></div>
</blockquote></div></div></div><div><div class="h5"><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Giovanni Allegri<br><a href="http://about.me/giovanniallegri" target="_blank">http://about.me/giovanniallegri</a><div>
Twitter: <a href="https://twitter.com/_giohappy_" target="_blank">https://twitter.com/_giohappy_</a></div>
<div>blog: <a href="http://blog.spaziogis.it" target="_blank">http://blog.spaziogis.it</a><br>GEO+ geomatica in Italia <a href="http://bit.ly/GEOplus" target="_blank">http://bit.ly/GEOplus</a></div></div>
</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Giovanni Allegri<br><a href="http://about.me/giovanniallegri" target="_blank">http://about.me/giovanniallegri</a><div>Twitter: <a href="https://twitter.com/_giohappy_" target="_blank">https://twitter.com/_giohappy_</a></div>
<div>blog: <a href="http://blog.spaziogis.it" target="_blank">http://blog.spaziogis.it</a><br>GEO+ geomatica in Italia <a href="http://bit.ly/GEOplus" target="_blank">http://bit.ly/GEOplus</a></div></div>
</div>