Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed
Assignees
markshannon
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usage
@markshannon

Description

@markshannon

Currently a plain Python object has the following fields:

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

TheWASTED 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__
  • valuesor __dict__
  • GC 1
  • GC 2
  • refcount
  • __class__

Seefaster-cpython/ideas#125 for full discussion

Linked PRs

Metadata

Metadata

Assignees

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usage

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp