This issue is to document a minor change to optimize codec.decode(). The codec modules are shared extensions and the CJK OUTCHAR() macro was calling a standard lib implementation for _PyUnicodeWriter_WriteChar. This was causing unnecessary overhead crossing back and forth between the shared object and the exported function for each character write.
There already exists a _PyUnicodeWriter_WriteCharInline to avoid this issue. Swapping in the inlined call to reduce overhead for all codecs in the package.
Activity
gh-156537: Optimize codec.decode by inlining the per-character write …
pythongh-156537: Inline CJK replacement writer call
pythongh-156537: Use takeref append in sqlite fetch paths
pythongh-156537: Inline _json scanstring writer call
pythongh-156537: Use takeref append in _csv
pythongh-156537: Optimize codec.decode by inlining the per-character …