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

Simplify _to_string encoding of Python strs #498

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

jakirkham
Copy link
Member

@jakirkham jakirkham commented Oct 16, 2024

Makes a few improvements to the Cython logic of _to_string:

  • Types the input as str: This allows Cython to use CPython API relevant for the specific type (it will check type on entry)
  • Do is not None check first: This way when Cython generates additional None checks inside the branch, the compiler can optimize them out
  • Use str's encode method: Cython makes a direct CPython call to generate bytes and then extracts the pointer and size for C++ to copy

@jakirkham jakirkham requested a review from a team as a code owner October 16, 2024 05:44
@jakirkham jakirkham added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Oct 16, 2024
Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

Thanks John

@wence-
Copy link
Contributor

wence- commented Oct 16, 2024

/merge

@rapids-bot rapids-bot bot merged commit a34d6bf into rapidsai:branch-24.12 Oct 16, 2024
54 checks passed
@jakirkham jakirkham deleted the simp_to_string branch October 16, 2024 19:37
@jakirkham
Copy link
Member Author

Thanks Lawrence! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants