python / python/cpython

Move Tier 2 interpreter out of `_PyEval_EvalFrameDefault`

Open
#116,970 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

See discussion starting here: https://github.com/faster-cpython/ideas/issues/631#issuecomment-1995191531

Basically, we see no real perf improvement for having the two switches inside the same function, and we have some indication that on Windows the compiler is failing to optimize this giant function. In addition, the logic for each of the interpreters is somewhat complicated due to sharing variables and labels.

This is not as simple as reverting gh-111428 (issue gh-111520), but in the abstract, that's the proposal.

The priority isn't clear, but it's probably doing before the 3.13 feature freeze.

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 linked faster-cpython discussion, then inspect _PyEval_EvalFrameDefault and the surrounding Tier 2 interpreter logic. Determine how the two interpreters currently share variables and labels and what boundaries are needed to separate them. Done means the Tier 2 interpreter is moved out while preserving interpreter behavior and addressing the stated optimization concern.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.