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

implement PyStringMethods #3677

Merged
merged 1 commit into from Dec 20, 2023
Merged

implement PyStringMethods #3677

merged 1 commit into from Dec 20, 2023

Conversation

davidhewitt
Copy link
Member

For #3382

There are some interesting bits going on in this PR:

  • to_str needs the GILPool to work for abi3 before Python 3.10, so I have added a #[cfg] on the corresponding PyStringMethods API.
  • I've introduced to_cow as a new API in PyStringMethods which is an alternative for users on abi3 before 3.10 (cc @alex)
  • I've added Py::to_str, Py::to_cow and Py::to_string_lossy as reads which can outlast the GIL lifetime, like we did for bytes (cf GIL-free references to Python data #2275)

@alex
Copy link
Contributor

alex commented Dec 20, 2023

Makes sense to me.

Copy link

codspeed-hq bot commented Dec 20, 2023

CodSpeed Performance Report

Merging #3677 will degrade performances by 33.39%

Comparing davidhewitt:string2 (f4f3169) with main (8bd2972)

Summary

❌ 1 regressions
✅ 77 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main davidhewitt:string2 Change
extract_str_downcast_success 422.2 ns 633.9 ns -33.39%

src/types/string.rs Outdated Show resolved Hide resolved
src/types/string.rs Outdated Show resolved Hide resolved
src/types/string.rs Outdated Show resolved Hide resolved
@adamreichold adamreichold added this pull request to the merge queue Dec 20, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 20, 2023
@davidhewitt
Copy link
Member Author

We've had a little bit of flakiness with PyPy 3.8 previously so will retry in the hope it's not caused by this PR.

@davidhewitt davidhewitt added this pull request to the merge queue Dec 20, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 20, 2023
@davidhewitt
Copy link
Member Author

Hmm I'll try to investigate this later 🤔

@davidhewitt davidhewitt added this pull request to the merge queue Dec 20, 2023
@davidhewitt
Copy link
Member Author

I noticed that PyPy 3.8 succeeded in the second run (but failed in the first), so I think this is just the usual PyPy flakiness :(

Merged via the queue into PyO3:main with commit 43827e3 Dec 20, 2023
35 of 37 checks passed
@davidhewitt davidhewitt deleted the string2 branch December 20, 2023 22:39
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