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 V
Victor Stinner committed
c1553bc34a537e00d6513da7df1c427df3570574
Parent: 73b4492
Committed by GitHub <noreply@github.com>
on 6/20/2024, 6:39:34 PM