Hi @Jeroen_Vermunt,
Depending on the size of your app, yes using modules can be an easy way to reclaim some performance! The benefit of using modules comes from allowing you to edit several smaller apps rather than one giant one.
Note that when editing the main app (e.g. when you are combining all the modules) there is no performance benefit from using modules, since all the nested components still have to be rendered.
What is the main contributor to poor performance?
This depends, but yes both the number of components and your custom JS logic can be a factor. Each component takes about 2 milliseconds (ms) to "evaluate" plus the time to evaluate any custom JS logic (usually it's fast but will depend on the exact code you provide).
Note that this "evaluation" only happens when data updates in the component's dependency tree. This is why we advise to "minimize long dependency chains". An update to one component will take time to propagate to all it's children, taking about 2ms per component in the chain.
How does lazy loading in Retool apps translate to better performance in the editor
Using modules or modals does not automatically lazy load components. However this is something we are actively working on and should be possible in the future!
For now, lazy loading can be done ad-hoc by different techniques. For example using a button to trigger updates using the JS API instead of creating long dependency chains.
Should we "clean-up" orphaned components?
Yes cleanup any unused components since they will add to the load time. If you have trouble finding a component use the command palette to quickly select the component you are looking for.
Feel free to reach out to us at performance@retool.com with more detailed information about your app and we can help you better troubleshoot issues!
Cheers,
Juan