New submission from Brandt Bucher <brandtbuc...@gmail.com>:
Rather than maintaining the offset of the "last instruction" (`f_lasti`), interpreter frames should instead just maintain a pointer to the true next instruction. This has several benefits, most notably reducing the register pressure associated with loading first_instr on every instruction and call in the main interpreter loop: When entering a frame: - Before: `next_instr = first_instr + frame->f_lasti + 1;` - After: `next_instr = frame->next_instr;` When starting a new instruction: - Before: `frame->next_instr = next_instr++ - first_instr;` - After: `frame->next_instr = ++next_instr;` Benchmarks suggest that this overhead is surprisingly significant (something like 2%). ---------- assignee: brandtbucher components: Interpreter Core messages: 416409 nosy: Mark.Shannon, brandtbucher priority: normal severity: normal stage: patch review status: open title: Frames should store next_instr instead of lasti type: performance versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue47177> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com