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

Free GIL when running check_bytes_arrays_within_dist #27

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mrecachinas
Copy link
Owner

@mrecachinas mrecachinas commented Nov 30, 2024

Fixes #23

Add GIL release in check_bytes_arrays_within_dist function.

  • Add Py_BEGIN_ALLOW_THREADS macro before the loop in check_bytes_arrays_within_dist_wrapper function in hexhamming/python_hexhamming.cc.
  • Add Py_END_ALLOW_THREADS macro after the loop in check_bytes_arrays_within_dist_wrapper function in hexhamming/python_hexhamming.cc.
  • Remove the in-loop return statement in check_bytes_arrays_within_dist_wrapper function in hexhamming/python_hexhamming.cc.
  • Add unit test test_check_bytes_arrays_within_dist_gil in test/test_hexhamming.py to verify the functionality of check_bytes_arrays_within_dist function with GIL released.

Fixes #23

Add GIL release in `check_bytes_arrays_within_dist` function.

- Add `Py_BEGIN_ALLOW_THREADS` macro before the loop in `check_bytes_arrays_within_dist_wrapper` function in `hexhamming/python_hexhamming.cc`.
- Add `Py_END_ALLOW_THREADS` macro after the loop in `check_bytes_arrays_within_dist_wrapper` function in `hexhamming/python_hexhamming.cc`.
- Remove the in-loop return statement in `check_bytes_arrays_within_dist_wrapper` function in `hexhamming/python_hexhamming.cc`.
- Add unit test `test_check_bytes_arrays_within_dist_gil` in `test/test_hexhamming.py` to verify the functionality of `check_bytes_arrays_within_dist` function with GIL released.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/mrecachinas/hexhamming/issues/23?shareId=XXXX-XXXX-XXXX-XXXX).
@mrecachinas mrecachinas requested a review from Copilot November 30, 2024 15:52
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 suggestion.

Files not reviewed (1)
  • hexhamming/python_hexhamming.cc: Language not supported

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more


def run_other_task():
for _ in range(5):
print("Running other task")
Copy link
Preview

Copilot AI Nov 30, 2024

Choose a reason for hiding this comment

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

[nitpick] The print statement is unnecessary for the test and could be removed to make the test cleaner.

Suggested change
print("Running other task")
for _ in range(5):
time.sleep(0.1)

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
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.

Free GIL when running check_bytes_arrays_within_dist
1 participant