Message365974
C++ and Java support what is known as "zero cost" exception handling.
The "zero cost" refers to the cost when no exception is raised. There is still a cost when exceptions are thrown.
The basic principle is that the compiler generates tables indicating where control should be transferred to when an exception is raised. When no exception is raised, there is no runtime overhead.
(C)Python should support "zero cost" exceptions.
Now that the bytecodes for exception handling are regular (meaning that their stack effect can be statically determined) it is possible for the bytecode compiler to emit exception handling tables.
Doing so would have two main benefits.
1. "try" and "with" statements would be faster (and "async for", but that is an implementation detail).
2. Calls to Python functions would be faster as frame objects would be considerably smaller. Currently each frame carries 240 bytes of overhead for exception handling. |
|
Date |
User |
Action |
Args |
2020-04-08 09:41:03 | Mark.Shannon | set | recipients:
+ Mark.Shannon |
2020-04-08 09:41:03 | Mark.Shannon | set | messageid: <1586338863.3.0.393749013734.issue40222@roundup.psfhosted.org> |
2020-04-08 09:41:03 | Mark.Shannon | link | issue40222 messages |
2020-04-08 09:41:02 | Mark.Shannon | create | |
|