Skip to content

Reimplement escape analysis for keyed in new FlatAST #12

Description

@hansihe

If we know the set of variables captured by a keyed, we can be smarter about when it is reevaluated.

As an example:

deft render(assigns) do
  for post <- assigns.posts do
    keyed post.id do
      %{
        id: post.id,
        name: post.name,
      }
    end
  end
end

If we know that the keyed post.id block only uses state from within post, and we know post has not changed since the last render, we can omit rendering that subtree entirely.

This is a simple example, so omitting rendering the subtree would not give us much here, but when scaled to deeper and more complicated data structures, being able to omit rendering subtrees like this could be a major advantage.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions