-
Notifications
You must be signed in to change notification settings - Fork 450
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
feat(python): release GIL for common functions #2269
feat(python): release GIL for common functions #2269
Conversation
I'm excited for this. Thanks for working on it @franz101 ! Looking briefly it looks like the linter is sad. |
python/src/lib.rs
Outdated
let (table, metrics) = rt()? | ||
.block_on(cmd.into_future()) | ||
.map_err(PythonError::from)?; | ||
self._table.state = table.state; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move updating the table state outside of the allow_threads
call? this requires mutating self
, which should be done while holding the GIL.
Same thing applies to other methods.
36206bd
to
97967cb
Compare
For the cases when you need the GIL, could you also release it and re-acquire it when needed, if the fraction of time it's not needed is large? |
Description
Inspired by the previous request to release the GIL added to most common functions.
Related Issue(s)
#2234
If some function are not supported / should not be released or I forgot to add the function, happy to modify the PR