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

Add missing HOLDGIL annotation for QgsGeometry::isEmpty #57735

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

nyalldawson
Copy link
Collaborator

No description provided.

@nyalldawson nyalldawson added Optimization I feel the need... the need for speed! backport queued_ltr_backports Queued Backports labels Jun 12, 2024
@github-actions github-actions bot added this to the 3.38.0 milestone Jun 12, 2024
Copy link

🪟 Windows builds ready!

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

(Built from commit 74ac9a0)

Copy link
Contributor

@troopa81 troopa81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really quick enough to holdGIL for any geometry ? QgsCurve isEmpty() implementation call nextVertex() which ends up calling pointAt for instance.

@nyalldawson
Copy link
Collaborator Author

@troopa81

Is it really quick enough to holdGIL for any geometry. QgsCurve isEmpty() implementation call nextVertex() which ends up calling pointAt for instance.

That's all still trivial vs the GIL handling cost.

For reference, the PyQt bindings are built with the default being to hold the GIL for everything except a few methods which are explicitly marked as releasing the GIL.

If I count the number of occurrences of the /ReleaseGIL/ tag in PyQt core library:

PyQt6-6.7.0/sip/QtCore$ grep -R ReleaseGIL | wc -l

there's only 283 methods in the WHOLE of Qt Core which were deemed potentially expensive enough to warrant releasing the GIL. 😮

(Our default is to release the GIL simply because there's a lot of methods in PyQGIS / the spatial realm which can block for many minutes, and it was easier to just release the gil by default and explicitly mark cheap exceptions vs identifying all the slow methods one-by-one.)

Copy link
Contributor

@troopa81 troopa81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nyalldawson OK, thanks for the explanation

@troopa81 troopa81 merged commit d4ddd04 into qgis:master Jun 12, 2024
38 checks passed
@nyalldawson nyalldawson deleted the hold_gil_empty branch June 17, 2024 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport queued_ltr_backports Queued Backports Optimization I feel the need... the need for speed!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants