| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead. |
Sorry, something went wrong.
|
You need to sign the CLA. Requesting @encukou who wanted to finish this per #1011 (comment) |
Sorry, something went wrong.
thanks for the review @picnixz ! 🙏 |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM!
I plan to merge this around Wednesday if there are no objections.
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry for ignoring this PR earlier. It did not looked important to me, and I was no longer sure about its usefulness, because path is usually so long.
Why use PyUnicodeWriter at first place? Does it make the code smaller/clearer? Is the performance difference too large?
Sorry, something went wrong.
@picnixz recommended PyUnicodeWriter in #136770 (comment) |
Sorry, something went wrong.
|
What were the problems with recreating the strings? Do you have any benchmark data? |
Sorry, something went wrong.
|
@serhiy-storchaka, what would be your preferred alternative to PyUnicodeWriter? As far as I know, @vstinner added it exactly for use cases like this. |
Sorry, something went wrong.
|
The original PR used PyUnicode_Substring() and PyUnicode_FromFormat() (similar code is also used in other places). It was pretty compact, half as short as the current code in this PR. It had also fast path for the case without keyword argument. I ask what are the benefits of the larger code. Is it performance? I would like to see the data. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM.
I'm fine with PyUnicodeWriter usage in this PR. It makes the code more verbose (than the first PR version), but the code is easy to read.
Sorry, something went wrong.
@serhiy-storchaka Please see a small benchmark test of the two alternatives here Yoav11#1 |
Sorry, something went wrong.
|
The code is bigger because it uses an extra function call rather than %s with hasargs ? ", " : "". It would be possible to do that with PyUnicodeWriter_Format too, and get back to roughly the same size of code. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you for your benchmark, @Yoav11. I checked myself, indeed, there is a measurable difference.
LGTM. 👍
Sorry, something went wrong.
|
Merged, thanks. |
Sorry, something went wrong.
|
thank you @vstinner @serhiy-storchaka @encukou @StanFromIreland @picnixz ! 🚀 🐍 |
Sorry, something went wrong.
…d path (python#136770) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: ynir3 <ynir3@bloomberg.net>
| Back | FazBrowse Home | New Git URL |
This PR was created during Europython 2025's sprint weekend.
This is a patch on #1011. authored by serhiy-storchaka and arhadthedev