Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist #115505

Merged
merged 4 commits into from
Feb 16, 2024

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Feb 15, 2024

@corona10 corona10 changed the title gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist [WIP[ gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist Feb 15, 2024
@corona10 corona10 changed the title [WIP[ gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist [WIP] gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist Feb 15, 2024
@corona10 corona10 changed the title [WIP] gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist Feb 15, 2024
@corona10
Copy link
Member Author

corona10 commented Feb 15, 2024

@ericsnowcurrently @colesbury Ready to review!

And this is the last PR.

@@ -71,6 +71,14 @@ struct _Py_dict_freelist {
#ifdef WITH_FREELISTS
/* Dictionary reuse scheme to save calls to malloc and free */
PyDictObject *free_list[PyDict_MAXFREELIST];
int numfree;
int keys_numfree;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need only one of numfree or keys_numfree in each struct.

Copy link
Member Author

Choose a reason for hiding this comment

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

nah copy and paste accident :)

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

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

Mostly LGTM

Aside from agreeing with @colesbury's point about dropping the "keys_numfree" fields, I have one mild suggestion about some local variable names (i.e. drop the "dict_"/"dictkeys_" prefix where not needed).

Include/internal/pycore_freelist.h Outdated Show resolved Hide resolved
Include/internal/pycore_freelist.h Outdated Show resolved Hide resolved
Objects/dictobject.c Outdated Show resolved Hide resolved
Objects/dictobject.c Outdated Show resolved Hide resolved
Objects/dictobject.c Outdated Show resolved Hide resolved
Objects/dictobject.c Outdated Show resolved Hide resolved
@bedevere-app
Copy link

bedevere-app bot commented Feb 15, 2024

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

@ericsnowcurrently
Copy link
Member

And thanks for taking the time for this PR!

@corona10
Copy link
Member Author

I have made the requested changes; please review again

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

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

Thanks for adjusting that! I have just one other small suggestion.

I'm approving the PR. I'll leave it up to you about my final suggestion.

Include/internal/pycore_freelist.h Outdated Show resolved Hide resolved
Objects/dictobject.c Outdated Show resolved Hide resolved
@corona10 corona10 requested a review from 1st1 as a code owner February 16, 2024 00:26
@corona10 corona10 enabled auto-merge (squash) February 16, 2024 00:27
@corona10 corona10 merged commit 321d13f into python:main Feb 16, 2024
33 checks passed
@ericsnowcurrently
Copy link
Member

Thanks again for all the great work on the freelists, @corona10!

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