FlaxEngine icon indicating copy to clipboard operation
FlaxEngine copied to clipboard

Improve Editor performance with large scene hierarchies

Open mafiesto4 opened this issue 1 year ago • 2 comments

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

mafiesto4 avatar Oct 13 '23 21:10 mafiesto4

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.

mafiesto4 avatar Oct 17 '23 13:10 mafiesto4

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.

GoaLitiuM avatar Jun 01 '24 19:06 GoaLitiuM