8 Commits

Author SHA1 Message Date
Nyall Dawson
149c106ea0 Optimise conversion of QgsAttributes to Python objects
Applies the same optimisations as are present in the QgsFeature
methods to avoid the overhead of sip's QVariant conversion logic
when attributes are of a basic type
2025-02-22 05:22:41 +10:00
Nyall Dawson
3a578d6712 Header update 2024-08-13 20:28:55 +10:00
Nyall Dawson
0c41c22343 Fix bad merge 2024-05-24 16:34:33 +10:00
Nyall Dawson
6185675c93 Additional shortcut to QgsAttributes creation from Python
Avoid constructing a bunch of default QVariant objects which
we will just replace immediately
2024-05-24 16:34:33 +10:00
Nyall Dawson
8941bbf599 Optimise QgsAttributes python constructor
Avoid multiple checks for detachment for each attribute
2024-05-24 16:34:33 +10:00
Jean Felder
0446f85409 qgsattributes: Optimize QgsAttributes python allocation
The python `QgsFeature.setAttributes()` calls is relatively slow
because of the call to `sipConvertToType` which needs to make in
intermediate allocation for each attribute QVariant creation.

This change aims to speed up this call by avoiding the call to
`sipConvertToType` for the most common types.
The change itself is quite simple. If the input attribute is a
boolean, an integer, a string or a floating, a QVariant is directly
created by using the python C API instead of calling
`sipConvertToType`.

Based on some testing on lists which can contain between 5 and 10
elements, I have measured an acceleration up up to 70%.
2024-05-23 05:15:16 +10:00
Matthias Kuhn
1bfc2785c9 Remove unrequired qgsfeature.h includes 2018-09-04 14:55:21 +02:00
Denis Rouzaud
7df2593caf move auto generated sip file in dedicated folder 2018-05-14 10:23:37 -04:00