Skip to content

bpo-37348: optimize decoding ASCII string#14291

Closed
methane wants to merge 1 commit intopython:masterfrom
methane:unicodewriter-init
Closed

bpo-37348: optimize decoding ASCII string#14291
methane wants to merge 1 commit intopython:masterfrom
methane:unicodewriter-init

Conversation

@methane
Copy link
Copy Markdown
Member

@methane methane commented Jun 21, 2019

gcc and clang can not optimize this code well:

_PyUnicodeWriter_Init(&writer);
writer.min_length = size;
_PyUnicodeWriter_Prepare(&writer, size, maxchar);

Add _PyUnicodeWriter_InitPrepare() which does same thing, but
more compiler friendly.

https://bugs.python.org/issue37348

gcc and clang can not optimize this code well:

    _PyUnicodeWriter_Init(&writer);
    writer.min_length = size;
    _PyUnicodeWriter_Prepare(&writer, size, maxchar);

Add _PyUnicodeWriter_InitPrepare() which does same thing, but
more compiler friendly.
@methane
Copy link
Copy Markdown
Member Author

methane commented Jun 21, 2019

#14283 is faster. _PyUnicode_Writer is a relatively large struct. Skip using it for a simple case is faster than initializing _PyUnicode_Writer.

@methane methane closed this Jun 24, 2019
@methane methane deleted the unicodewriter-init branch June 24, 2019 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review performance Performance or resource usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants