-
Notifications
You must be signed in to change notification settings - Fork 955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reuse a single TreeWalker in nested templates #825
Conversation
Creating `TreeWalker`s isn't very optimized, so reusing a single one in the nested templates can speed it up a bit. https://jsbench.github.io/#d0363ded1753dec3e060e61e1794896b
On the heels of lit#825, this unrolls our recursive template processor into a stack based one.
I don't care that much about optimizing nested templates, since that should be a pretty rare case and we added support mainly for correctness so lit-html templates didn't blow up with nested templates... But, if reusing a TreeWalker is that much faster, what if we reused one across the all templates? That could have an impact on real-world code (though I do think we're at the point where DOM mutation operations are dominating costs already). The |
That was the end-goal. 😉
Unfortunately, we're not there yet. #831 has to come first, then we need to fix the reentrancy behavior in |
On the heels of lit#825, this unrolls our recursive template processor into a stack based one.
On the heels of lit#825, this unrolls our recursive template processor into a stack based one.
On the heels of #825, this unrolls our recursive template processor into a stack based one.
Creating `TreeWalker`s isn't very optimized, so reusing a single one in the nested templates can speed it up a bit. https://jsbench.github.io/#d0363ded1753dec3e060e61e1794896b
On the heels of lit#825, this unrolls our recursive template processor into a stack based one.
Creating
TreeWalker
s isn't very optimized, so reusing a single one in the nested templates can speed it up a bit.https://jsbench.github.io/#d0363ded1753dec3e060e61e1794896b