This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brandtbucher
Recipients brandtbucher
Date 2021-06-26.00:11:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1624666320.05.0.738166042939.issue44511@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-06-26 00:12:00brandtbuchersetrecipients: + brandtbucher
2021-06-26 00:12:00brandtbuchersetmessageid: <1624666320.05.0.738166042939.issue44511@roundup.psfhosted.org>
2021-06-26 00:12:00brandtbucherlinkissue44511 messages
2021-06-26 00:11:59brandtbuchercreate