Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QgsFeature python optimisations #57482

Merged
merged 4 commits into from
May 24, 2024
Merged

QgsFeature python optimisations #57482

merged 4 commits into from
May 24, 2024

Conversation

nyalldawson
Copy link
Collaborator

Optimise some more frequently called methods for use in PyQGIS

Copy link

github-actions bot commented May 18, 2024

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit 5ccd7e2)

@ptitjano
Copy link
Contributor

@nyalldawson Thanks. Have you been able to test it and measure the improvement?

@nyalldawson
Copy link
Collaborator Author

@ptitjano

Have you been able to test it and measure the improvement?

With a similar test to the loop from #57470, calling 10.5 million times

Before:
18.3s

After:
16.4s

With the optimisations from #57470:

Before (#57470 alone):
12.8s

After (this + #57470):
11.7s

So no where near as dramatic as #57470, but still worthwhile!

Avoid multiple checks for detachment for each attribute
Avoid constructing a bunch of default QVariant objects which
we will just replace immediately
@qgis qgis deleted a comment from github-actions bot May 23, 2024
@nyalldawson
Copy link
Collaborator Author

@troopa81 good to merge now?

@nyalldawson nyalldawson merged commit 0c41c22 into qgis:master May 24, 2024
28 of 29 checks passed
@nyalldawson nyalldawson deleted the set_attr branch May 24, 2024 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants