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

Inline values array into the object #115776

Open
Assignees
markshannon
Labels
3.13bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagetype-featureA feature request or enhancement
@markshannon

Description

@markshannon

Feature or enhancement

Currently when allocating a plain Python object, we allocate the object, and its values array.
This has a few downsides:

  1. We perform two allocations instead of one.
  2. An extra indirection is needed when accessing an attribute on the object
  3. If the__dict__ is materialized we can no longer use specialized lookup.

We could fix three with an extra pointer in the object header, but that would waste more space.

We should append the values array directly after the object header, which fixes the above issues.

It adds some complexity, as we need to track ownership of the values so that they are freed exactly once, but may enable some simplifications as well. Overall, it would seem to make little difference to complexity.

Seefaster-cpython/ideas#72 for more discussion.

Linked PRs

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagetype-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp