I'm doing a lot (really a lot) of feature requests on a vector layer. These requests are capsuled in iterations and functions, so no way of reducing the total number of requests.
Although I consider the #1 tip concerning QgsVectorLayer.getFeatures()
- use a specific request whenever possible (Why use QgsFeatureRequest() when iterating?) - I end up with low performance and cProfile
tells me the bottleneck is still the feature request.
Btw, using layer.getFeature(fid)
instead of
request = QgsFeatureRequest().setFilterFid(fid)
feature = next(layer.getFeatures(request))
doesn't make any difference.
How do I speed up my feature requests, when I know each feature is called lots of times?