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.
PR is ready to attach to issue.
Linked PRs
This issue is to document a minor change to optimize
codec.decode(). The codec modules are shared extensions and the CJKOUTCHAR()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_WriteCharInlineto avoid this issue. Swapping in the inlined call to reduce overhead for all codecs in the package.PR is ready to attach to issue.
Linked PRs