Skip to content

gh-100240: Use a consistent implementation for freelists#121934

Merged
colesbury merged 6 commits into
python:mainfrom
colesbury:gh-100240-freelist
Jul 22, 2024
Merged

gh-100240: Use a consistent implementation for freelists#121934
colesbury merged 6 commits into
python:mainfrom
colesbury:gh-100240-freelist

Conversation

@colesbury

@colesbury colesbury commented Jul 17, 2024

Copy link
Copy Markdown
Contributor

This combines and updates our freelist handling to use a consistent implementation. Objects in the freelist are linked together using the first word of memory block.

When Python is configured to build without freelists, these operations are essentially no-ops.

This combines and updates our freelist handling to use a consistent
implementation. Objects in the freelist are linked together using the
first word of memory block.

If configured with freelists disabled, these operations are essentially
no-ops.
@colesbury

Copy link
Copy Markdown
Contributor Author

I'm putting this up for discussion and feedback.

@markshannon, this doesn't do all the things listed in the issue -- I haven't
changed the capacity of the freelists and they're still separated by type --
but it removes a lot of duplicated code.

In my limited testing, I haven't seen a significant performance difference.

@colesbury colesbury requested a review from a team as a code owner July 17, 2024 19:09
@markshannon

Copy link
Copy Markdown
Member

Perfomance is in the noise but doesn't look like it's any worse.

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very nice. +290 −700 had me sold 🙂

A lot of compiler warnings, but should be fixable with one cast in the _Py_FREELIST_SIZE macro.

Consider it approved once the macro is fixed.

Comment thread Include/internal/pycore_freelist.h Outdated

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome!

Consider it approved once the macro is fixed.

Same opinion :)

@colesbury

Copy link
Copy Markdown
Contributor Author

!buildbot AMD64 Ubuntu NoGIL Refleaks

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @colesbury for commit aa8e4d5 🤖

The command will test the builders whose names match following regular expression: AMD64 Ubuntu NoGIL Refleaks

The builders matched are:

  • AMD64 Ubuntu NoGIL Refleaks PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants