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
Rewrite PyUnicode_FromFormatV() to use the _PyUnicodeWriter API #60351
Comments
Attached patch rewrites PyUnicode_FromFormatV():
_tescapi.test_string_from_format() is 20% faster with the patch according to timeit. I don't know how to write better benchmarks because PyUnicode_FromV() is not exposed in Python. I wrote a benchmark using ctypes to call the function, but it looks like the ctypes overhead is too high. I wrote the patch to simplify the code, but it may be faster thanks to the _PyUnicodeWriter API and some optimizations implemented in the patch. |
"Split PyUnicode_FromFormatV() into smaller functions: add unicode_fromformat_arg(). It requires to copy vargs using Py_VA_COPY: without Py_VA_COPY, the function does crash. I don't understand why." Ok, here is the answer. In short: va_list can be an array (of 1 element) on some platforms (ex: AMD64). |
New changeset b4bee17625e1 by Victor Stinner in branch 'default': New changeset d1369daeb9ec by Victor Stinner in branch 'default': New changeset 5e319fdab563 by Victor Stinner in branch 'default': |
New changeset e16ec3b468d1 by Victor Stinner in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: