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

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

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

markshannon commented Jul 25, 2022

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

@iritkatriel
Copy link
Member

iritkatriel commented Sep 10, 2022

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

markshannon commented Sep 12, 2022

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