You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/brandtbucher'closed_at=Nonecreated_at=<Date2021-06-26.00:12:00.030>labels= ['interpreter-core', '3.11']
title='Improve the bytecode for mapping patterns'updated_at=<Date2021-11-02.00:29:19.363>user='https://github.com/brandtbucher'
The generated bytecode for mapping patterns is more complicated than it needs to be:
Matching sub-patterns involves indexing into a tuple of values in order to extract them. We already know the size of this tuple at compile-time, so we can just unpack it onto the stack instead.
COPY_DICT_WITHOUT_KEYS isn't used anywhere else, and can be emulated with existing, smaller instructions (albeit using quite a few of them).
MATCH_KEYS doesn't need to push a boolean indicating match / no match. It already pushes None on no match, so following it with a simple DUP_TOP() + LOAD_CONST(None) + IS_OP(1) should suffice.
These are mostly just refactoring opportunities... quick-and-dirty measurements of Lib/test_patma.py show no performance impact for these changes.
Programs/_freeze_importlib
#29357Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: