Optimize control search performance
masterSearching the entire tree from the root is inefficient. Instead, use hierarchical searching by specifying searchDepth at each level to narrow down the search space quickly.
# Efficient hierarchical search
window2 = uiautomation.WindowControl(searchDepth=1, Name='window2')
sub = window2.Control(searchDepth=1, Name='2-4')
edit = sub.EditControl(searchDepth=1, Name='myedit2')
edit.SendKeys('hi')