[issue44511] Improve the bytecode for mapping patterns

2021-11-01 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +27617
pull_request: https://github.com/python/cpython/pull/29357

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44511] Improve the bytecode for mapping patterns

2021-10-27 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 82a662e5216a9b3969054c540a759a9493468510 by Brandt Bucher in 
branch 'main':
bpo-44511: Improve the bytecode for class and mapping patterns (GH-26922)
https://github.com/python/cpython/commit/82a662e5216a9b3969054c540a759a9493468510


--
nosy: +Mark.Shannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44511] Improve the bytecode for mapping patterns

2021-06-26 Thread Brandt Bucher


Change by Brandt Bucher :


--
keywords: +patch
pull_requests: +25495
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26922

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44511] Improve the bytecode for mapping patterns

2021-06-25 Thread Brandt Bucher


New submission from Brandt Bucher :

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.

--
assignee: brandtbucher
components: Interpreter Core
messages: 396533
nosy: brandtbucher
priority: normal
severity: normal
status: open
title: Improve the bytecode for mapping patterns
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com