gh-119182: Use public PyUnicodeWriter API in union_repr() (#120797) · python/cpython@c1553bc · GitHub
Skip to content

Commit c1553bc

Browse files
authored
gh-119182: Use public PyUnicodeWriter API in union_repr() (#120797)
The public PyUnicodeWriter API enables overallocation by default and so is more efficient. Benchmark: python -m pyperf timeit \ -s 't = int | float | complex | str | bytes | bytearray' \ ' | memoryview | list | dict' \ 'str(t)' Result: 1.29 us +- 0.02 us -> 1.00 us +- 0.02 us: 1.29x faster
1 parent 73b4492 commit c1553bc

1 file changed

Lines changed: 30 additions & 24 deletions

File tree

Objects/unionobject.c

Lines changed: 30 additions & 24 deletions

0 commit comments

Comments
 (0)