Message286591
If you would like to implement constant folding at the AST level, I suggest
you to look at my fatoptimizer project:
https://github.com/haypo/fatoptimizer/blob/master/fatoptimizer/const_fold.py
The tricky part is to avoid operations when we know that it will raise an
exception or create an object too big according to our constraints.
I would prefer to implement an AST optimizer in Python, but converting C
structures to Python objects and then back to C structures has a cost. I'm
not sure that my optimizer implemented in Python is fast enough.
By the way, an idea would be to skip all optimizations in some cases like
for script.py when running python3 script.py. |
|
Date |
User |
Action |
Args |
2017-02-01 07:04:07 | vstinner | set | recipients:
+ vstinner, brett.cannon, georg.brandl, rhettinger, terry.reedy, gregory.p.smith, mark.dickinson, ncoghlan, pitrou, techtonik, nadeem.vawda, benjamin.peterson, alex, Trundle, methane, dmalcolm, meador.inge, daniel.urban, Jeremy.Hylton, santoso.wijaya, eltoder, eric.snow, jcon, berker.peksag, serhiy.storchaka, pconnell, isoschiz, pstch |
2017-02-01 07:04:07 | vstinner | link | issue11549 messages |
2017-02-01 07:04:06 | vstinner | create | |
|