Skip to content

Performance: CJK codec decoders pay a cross-module call per character #156537

Description

@brittanyrey

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions