]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-119182: Use public PyUnicodeWriter API in ga_repr() (#120799)
authorVictor Stinner <vstinner@python.org>
Thu, 20 Jun 2024 18:35:35 +0000 (20:35 +0200)
committerGitHub <noreply@github.com>
Thu, 20 Jun 2024 18:35:35 +0000 (20:35 +0200)
commit73b4492c19f494c1b10dfa0b80840a52ce3c63a2
treed125e52d81b43b51f168619e482e0c5918323ada
parent31ce5c05a489fa22f30c4afdec162e4e669af15a
gh-119182: Use public PyUnicodeWriter API in ga_repr() (#120799)

The public PyUnicodeWriter API enables overallocation by default and
so is more efficient.

Benchmark:

python -m pyperf timeit \
    -s 't = list[int, float, complex, str, bytes, bytearray, ' \
                 'memoryview, list, dict]' \
    'str(t)'

Result:

1.49 us +- 0.03 us -> 1.10 us +- 0.02 us: 1.35x faster
Objects/genericaliasobject.c