FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-148675: Optimize arraydescr structure: use char[3] by vstinner · Pull Request #149455 · python/cpython · GitHub

/ cpython Public

gh-148675: Optimize arraydescr structure: use char[3] - #149455

Merged
encukou merged 1 commit into
python:mainfrom
vstinner:array_typecode
May 6, 2026
Merged

gh-148675: Optimize arraydescr structure: use char[3]#149455
encukou merged 1 commit into
python:mainfrom
vstinner:array_typecode

Conversation

vstinner commented May 6, 2026
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Replace "const char *typecode;" with "char typecode[3];" to make the arraydescr structure smaller and avoids an indirection.

Replace "const char *typecode;" with "char typecode[3];" to make the
arraydescr structure smaller and avoids an indirection.

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32562183 | 📁 Comparing 1b52f8c against main (70e365c)

  🔍 Preview build  

2 files changed
± library/functions.html
± whatsnew/3.15.html

vstinner commented May 6, 2026

Copy link
Copy Markdown
Member Author

@scoder @encukou: Would you mind to review this change?

scoder left a comment
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good to me. Enough to change the struct field back to its previous (padded) size.

scoder commented May 6, 2026

Copy link
Copy Markdown
Contributor

Personally, I would also have optimised the strcmp() calls into single character comparisons to make it clear to the C compiler that that's almost always enough for taking the decision, but that'd be an optimisation with yet-to-be-measured benefit, not a fix. Definitely not something that comes with a deadline.

encukou merged commit 9274d96 into python:main May 6, 2026
60 checks passed
vstinner deleted the array_typecode branch May 6, 2026 14:34

vstinner commented May 6, 2026

Copy link
Copy Markdown
Member Author

Thanks for merging my change @encukou :-)

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL