8000 Reduce the size of plain Python objects from 8 to 6 machine words. · Issue #95245 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Reduce the size of plain Python objects from 8 to 6 machine words. #95245

New issue

Have a question about t 8000 his 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

Closed
markshannon opened this issue Jul 25, 2022 · 2 comments
Closed

Reduce the size of plain Python objects from 8 to 6 machine words. #95245

markshannon opened this issue Jul 25, 2022 · 2 comments
Assignees
Labels
pending The issue will be closed if no feedback is provided performance Performance or resource usage

Comments

@markshannon
Copy link
Member

Currently a plain Python object has the following fields:

  • values
  • (managed) __dict__
  • GC 1
  • GC 2
  • refcount
  • __class__
  • __weakrefs__
  • WASTED

The WASTED field is present because, due to alignment, we must allocate a multiple of 2 words.
We can reduce this to 6 by merging the values and __dict__ pointers into one (only one can be valid at any time),
and then moving the __weakrefs__ field into the empty space.

  • __weakrefs__
  • values or __dict__
  • GC 1
  • GC 2
  • refcount
  • __class__

See faster-cpython/ideas#125 for full discussion

@markshannon markshannon added the performance Performance or resource usage label Jul 25, 2022
@markshannon markshannon changed the title Reduce the size of plain objects from 8 to 6 machines words. Reduce the size of plain Python objects from 8 to 6 machine words. Jul 25, 2022
@mdboom mdboom moved this from Todo to In Progress in Fancy CPython Board Jul 26, 2022
@markshannon markshannon moved this from In Progress to In Review in Fancy CPython Board Aug 15, 2022
@markshannon markshannon moved this from In Review to Done in Fancy CPython Board Aug 22, 2022
@iritkatriel
Copy link
Member

Is there anything left to do here?

@iritkatriel iritkatriel added the pending The issue will be closed if no feedback is provided label Sep 10, 2022
@markshannon
Copy link
Member Author

Nothing more to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending The issue will be closed if no feedback is provided performance Performance or resource usage
Projects
None yet
Development

No branches or pull requests

2 participants
0