Closed Janpot closed 1 year ago
I didn't notice at the time but those changes might have an impact on the performance... Thanks for looking into it, let me know if I can help with anything!
Edit: also we could try to create some automated checks for performance eventually, it might be useful to prevent this kind of issue
Steps to reproduce 🕹
Steps:
Notice it renders on every keystroke and the renders take about ~200 - ~250ms to complete (I'm on a Macbook air M1):
Current behavior 😯
It's just too slow. Did a quick code review and the biggest contributor to this sluggishness seems to be because we are recalculating the state for the whole page on every node we render. This is a regression that was likely introduced when we added nested scopes to the runtime to enable List and Form components. Before that the whole page used to be calculated on every keystroke, but only once. This is also a bit wasteful, but nothing compared to doing it on every node which turns a O(n) algorithm into O(n^2) (n being the amount of nodes on the page).
Expected behavior 🤔
The page state is only calculated once for the whole page