Re: Recursion Performance Question

2008-07-24 Thread Tim Golden
B wrote: Now it works, but it runs quite slow (compared to the c++ app). I changed gwl from strait recursion to use a generator and that helped, but it still takes 0.5-1.0 seconds to populate the tree. What I'm wondering is am I doing it in a really inefficient way, or is it just python?

Re: Recursion Performance Question

2008-07-24 Thread Anders J. Munch
B wrote: # pass in window handle and parent node def gwl(node, hwnd): if hwnd: yield node, hwnd for nd, wnd in Wnd.gwl(node.children[-1], GetWindow(hwnd, GW_CHILD)): yield nd, wnd for nd, wnd in Wnd.gwl(node, GetWindow(hwnd,

Recursion Performance Question

2008-07-23 Thread B
Hey I found some (VERY) old C++ code of mine that recursively built a tree of the desktop window handles (on windows) using: (they are stored in an STL vector) void FWL(HWND hwnd, int nFlag) // Recursive Function { hwnd = GetWindow(hwnd, nFlag); if(hwnd == NULL)