AST Optimizers

Intro

An AST optimizer rewrites the Abstract Syntax Tree (AST) of a Python module to produce a more efficient code.

Currently in CPython 3.5, only basic optimizations are implemented by rewriting the bytecode: CPython peephole optimizer.

fatoptimizer

fatoptimizer project: AST optimizer implementing multiple optimizations and can specialize functions using guards of the fat module.

pythran AST

pythran.analysis.PureFunctions of pythran project, depend on ArgumentEffects and GlobalEffects analysis: automatically detect pure functions.