jinja2.optimizer

jinja2.optimizer

The jinja optimizer is currently trying to constant fold a few expressions and modify the AST in place so that it should be easier to evaluate it.

Because the AST does not contain all the scoping information and the compiler has to find that out, we cannot do all the optimizations we want. For example loop unrolling doesn’t work because unrolled loops would have a different scoping.

The solution would be a second syntax tree that has the scoping rules stored.

copyright:
  1. 2010 by the Jinja Team.
license:

BSD.

Classes

Optimizer

Functions

optimize(node, environment) The context hint can be used to perform an static optimization

Defined

  • NodeTransformer
  • nodes

Table Of Contents

Previous topic

get_eval_context

Next topic

Optimizer Class