FlaxEngine
FlaxEngine copied to clipboard
Improve Editor performance with large scene hierarchies
Use https://github.com/Tryibion/FlaxPerformanceTest as a reference test point and spawn 10k cubes in the root of the scene. Editor UI update and draw performance should be perfectly stable thus we need to:
- profile current state (with Tracy and with C# profiling like dotTrace or Visual Studio)
- update only visible controls (currently
TreeNode
tick when expanded and enabled) - draw only visible controls (
ContainerControl
already has some culling mechanism but for tree hierarchy, we can do better) - use some smart-logic for mouse events (
OnMouseXXX
) to skip iterating over all controls in tree node
Apply similar optimization to ContentView
control which can display eg. 4,000 items at once.
We can assume that both tree and content views are displaying items in linear way so could just cache first and last items index to draw/update/interact - the trick would be to properly skip using the cached indices range. Also, do it in a clean way: eg. via utility to quickly run custom code over range of UI controls.
TreeNode related optimizations were done in #2462, though instead of caching the state of displayable items in the tree, the items are skipped by estimating the first visible item from the scrolled view position.