<div dir="ltr">Hi,<div><br></div><div>I was working on a plugin, but I wanted to increase performance by using multiple threads for my plugin. I was doing this either by creating a QObject and moving it to a new QThread, but I also tried inheriting from a QThread class, but both options didn't have any performance increase. </div><div><br></div><div>In general my code workflow is as follows (I tried both 1a and 1b):</div><div>1a. plugin_dialog.accept() starts two workers (class FeatureSelector(QThread))</div><div>1b. plugin_dialog.accept() starts two workers (class Worker(QObject)) and moves each instance to a seperate QThread<br></div><div>2. Each worker iterates over half of the total features and select features based on a expression (QgsFeatureRequest().setFilterExpression(expression)).</div><div>3. On signal finished of each FeatureSelector instance, the return values are put back together again and used to create a new memory layer)</div><div><br></div><div>I thought, maybe QGIS already optimized threads and therefore, this is the fastest my plugin is going to be, no matter how many threads I use? Or maybe there is a better way of running multiple threads in QGIS?<br></div><div><br></div><div>Best,</div><div>Matthijs</div></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><b>Matthijs Bon</b><div><i>Student Geomatics</i></div><div><i>Delft University of Technology</i></div><div><i>4133390</i></div><div><br></div><font color="#000000"><b><font color="#0000FF">T:</font></b> +31 (0)6 816 766 79<br></font><div><b><font color="#0000FF">E: </font></b><a href="mailto:thijssie2008@gmail.com">thijssie2008@gmail.com</a></div></div></div>