Skip to content

The LOAD_ATTR_INSTANCE_VALUE instruction can be sped up by storing the offset of the valid field in the cache. #152063

Description

@markshannon

LOAD_ATTR_INSTANCE_VALUE needs to check the validity of the objects embedded values array.
Currently, it does that by computing the offset of the valid byte.
Instead we could store the offset in the inline cache as LOAD_ATTR_INSTANCE_VALUE has several inline cache entries to spare.

The check is done in the _CHECK_MANAGED_OBJECT_HAS_VALUES uop.

Linked PRs

Activity

  1. added
    performancePerformance or resource usage
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    3.16new features, bugs and security fixes
    on Jun 24, 2026
  2. markshannon commented on Jun 24, 2026

    @markshannon
    MemberAuthor

    This is not a new feature, just a small optimization.

  3. brijkapadia commented on Jun 25, 2026

    @brijkapadia
    Contributor

    Could this also be applied to LOAD_ATTR_METHOD_WITH_VALUES and LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES since after gh-152066, all three of these would use _CHECK_MANAGED_OBJECT_HAS_VALUES?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.16new features, bugs and security fixesinterpreter-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