[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

Antoine Pitrou report at bugs.python.org
Fri Dec 29 07:00:08 EST 2017


Antoine Pitrou <pitrou at free.fr> added the comment:

Le 29/12/2017 à 12:48, Mark Shannon a écrit :
> 
> Why all these competing pull requests? It does feel like my original patch has been hijacked.

The original patch had a number of issues which needed to be fixed (in
addition to forward-port it to the latest git master), such as not
fixing some cases of stack consumption calculation.

> Also, before any more PRs, we need to decide whether to use subroutines or code duplication for finally blocks.
> 
> Here is my attempt at an objective comparison of the two approaches.
> 
>                        JSR style           Code duplication
> Speed                  Slower              Faster
> Interpreter            More complex        Simpler
> Bytecode generation    Simpler             More complex
> Bytecode size          ~ +0.1%             ~ +0.4%

Actually, when looking at your original patch
(https://bugs.python.org/review/17611/) vs. Serhiy's
https://github.com/python/cpython/pull/5006/, it looks like interpreter
complexity is the same.  Speed also seems to not be significantly
different.  So I would rephrase it as (compared to legacy bytecode
generation):

                      Subroutine              Code duplication
Speed                 Same                    Insignificantly faster
Interpreter           Simpler                 Simpler
Bytecode generation   Slightly more complex   Slightly more complex
Bytecode size         ~ +0.1%                 ~ +0.4%

That said, if you want to submit an updated version of the code
duplication approach (with the same amount of added tests and
debugging), we could compare on more equal grounds.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue17611>
_______________________________________


More information about the Python-bugs-list mailing list