summary
Currently, amp-bind uses a TreeWalker in order to find bindings on elements. This is an expensive operation. We can significantly speed this up via preprocessing in the AMP Optimizer.
Instead of using the TreeWalker, we could use the optimizer to place the attribute i-amphtml-binding on each element with a binding and use querySelectorAll in the runtime to find them.
todo
cc @ampproject/wg-runtime
summary
Currently,
amp-binduses a TreeWalker in order to find bindings on elements. This is an expensive operation. We can significantly speed this up via preprocessing in the AMP Optimizer.Instead of using the TreeWalker, we could use the optimizer to place the attribute
i-amphtml-bindingon each element with a binding and usequerySelectorAllin the runtime to find them.todo
cc @ampproject/wg-runtime