Skip to content

Conversation

@vstinner
Copy link
Member

@vstinnervstinner commented Jun 20, 2024

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 

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
@vstinnervstinner merged commit 73b4492 into python:mainJun 20, 2024
@vstinnervstinner deleted the ga_repr branch June 20, 2024 18:35
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
…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
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
…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
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
…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
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@vstinner