preparing the big 2.0 release
[jinja2.git] / TODO
diff --git a/TODO b/TODO
index 1659c3950a444938c4bf5c57b208ac1d3ab4e126..a95193680f0f5a59a3d03e0e13328801b960a982 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,9 +1,39 @@
+Todo Before Release
 ===================
-TODO List for Jinja
-===================
 
--   Improve the context lookup (maybe with an optional C extension)
+This has to be implemented before the release:
+
+Pull Attributes Onces
+---------------------
+
+Imagine the following template::
+
+    {% if foo.bar %}
+        {{ baz(foo.bar) }}
+    {% endif %}
+
+Problem with that is that it compiles to this::
+
+    if environment.subscribe(l_foo, 'bar'):
+        if 0: yield None
+        yield u'\n    %s\n' % (
+            l_baz(environment.subscribe(l_foo, 'bar')),
+        )
+
+As `environment.subscribe` is more expensive then regular attribute lookups
+(it tries getitem/getattr and in sandbox mode also permissions) multiple
+lookups with the same parameters in the same scope should get local aliases.
+The result we have is that one::
+
+    t1 = environment.subscribe(l_foo, 'bar')
+    if t1:
+        if 0: yield None
+        yield u'\n    %s\n' % (
+            l_baz(t1),
+        )
 
--   `include` and `extends` should work with dynamic data too. In order to
-    support this the blocks should be stored as importable functions in the
-    generated source.
+However that should only happen if the attribute is accessed multiple times
+unlike locals and filters/tests which are always pulled.  We're not doing that
+for filters/tests/locals as nested scopes may access it and testing is too
+complicated for the tiny performance improvement but easy for attribute
+lookups, keeping the complexity of the whole thing in mind.