gh-125196: Add a free list to PyUnicodeWriter by vstinner · Pull Request #125227 · python/cpython · GitHub
Skip to content

gh-125196: Add a free list to PyUnicodeWriter - #125227

Merged
vstinner merged 2 commits into
python:mainfrom
vstinner:writer_freelist
Oct 10, 2024
Merged

vstinner merged 2 commits into
python:mainfrom
vstinner:writer_freelist

Conversation

@vstinner

@vstinner vstinner commented Oct 9, 2024

Copy link
Copy Markdown
Member

@vstinner

vstinner commented Oct 9, 2024

Copy link
Copy Markdown
Member Author

@vstinner

vstinner commented Oct 9, 2024

Copy link
Copy Markdown
Member Author

@pitrou: That's one way to reduce the cost of the PyUnicodeWriter_Create() memory allocation.

@vstinner

vstinner commented Oct 9, 2024

Copy link
Copy Markdown
Member Author

cc @serhiy-storchaka

I started with a free list of 1 item. We may enlarge it later for nested function calls, like repr() of a list which contains lists (which may contain lists as well, etc.).

@vstinner

Copy link
Copy Markdown
Member Author

@vstinner
vstinner merged commit 1639d93 into python:main Oct 10, 2024
@vstinner
vstinner deleted the writer_freelist branch October 10, 2024 10:11
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.

1 participant