New submission from Om G <im.omgupta+pyt...@gmail.com>:

During optimization, the compiler deletes blocks that are marked as 
unreachable. In doing so, it can render jump instructions that used to jump 
over the now-deleted blocks redundant, since simply falling through to the next 
non-empty block is now equivalent.

An example of a place where this occurs is around "if condition: statement; 
else: break" style structures (see attached proof of concept code below), but 
this is a general case and could occur in other places.

Tested on the latest 3.10 branch including all recent compile.c changes.

----------
files: jmptest.py
messages: 382834
nosy: OmG
priority: normal
severity: normal
status: open
title: Redundant jump instructions due to deleted unreachable bytecode blocks
type: performance
versions: Python 3.10
Added file: https://bugs.python.org/file49664/jmptest.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42615>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to