python / python/cpython

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

Open
#152,063 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.16 interpreter-core performance
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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
  • gh-153122

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the LOAD_ATTR_INSTANCE_VALUE instruction and the _CHECK_MANAGED_OBJECT_HAS_VALUES uop in CPython's interpreter implementation. Review how the instruction's inline cache entries are defined and how the validity-byte offset is currently computed. Done means the offset is stored in an available inline cache entry and the validity check uses it, with the related tests and benchmarks still passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.