Window::getTargetChildAtPosition performance

Issue #738 new
Former user created an issue

Automatic migration. Original reporter: "fedyakin"

This function is typically one of our top five hotspots. I'm not sure if the problem is general, or specific to our usage of cegui.

I think the reason it is so expensive, is the combination of a few factors.
1) The worst case for this function, is when the mouse is over the root window. In this case the function has to check all the windows in the interface. 2) The cost of this function is linear with the number of windows. 3) Functions that move or resize windows result in calls to this function. With a large number of windows, that the mouse is not over, and a few moving windows, a decent amount of time can be spent in this function.

Reproducibility: N/A

Additional information: I don't really have any good suggestions to improve this...

I think the best bet to reduce the function's cost, is to reduce how many windows it needs to check. However, because windows can draw outside of the bounds of their parent, there is no good way to reject a hierarchy of windows.

It might be possible to defer additional calls to this function when windows move / resize until the next frame. The window containing the mouse is updated then.

OS: Windows, OS build: Windows 7 64 bit, Platform: PC

Comments (1)

  1. Log in to comment