hautzenroeder1
12 years agoOccasional Contributor
Question on FindChild routine
Just a curious question:
I have a test script that tests a complicated UI that also includes WPF animation.
The test script contained 12 SET statements to identify various user buttons, drop-down lists, and various components on the WPF animation.
it was taking anywhere from 40 seconds to 50 seconds for the routine to initialize all the Set statements before the script started working.
As the script sequences through this script over 400 times as part of a bigger script, Obviously, 400 times 40 seconds was wasting a big chunk of time.
As some of the Set statements went 15 layers deep to the various WPF objects, this was causing me some headaches everytime the WPF animation was updated.
I then started using the FindChild with starting with a top level branch then use the FindChild to find the test object.
Not only did this make my code look cleaner, But the 40 to 50 second initialization dropped to under 4 seconds.
Question is: Why is using FindChild, even with the search path looking through several long branches much faster than specifying each step of the long chain?
40 seconds down to under 4 seconds when using over 400 iterations is a huge time savings on my script Run time and I'm not complaining.
It just seems counter inuitive for have a search function run 10 times faster than specifying the entire string.
Any ideas why?
I've started using the FindChild routine in all of my subscripts and finding my scripts are running much faster.
Plus, whenever a developer changes something, it doesn't break my scripts. :)
I have a test script that tests a complicated UI that also includes WPF animation.
The test script contained 12 SET statements to identify various user buttons, drop-down lists, and various components on the WPF animation.
it was taking anywhere from 40 seconds to 50 seconds for the routine to initialize all the Set statements before the script started working.
As the script sequences through this script over 400 times as part of a bigger script, Obviously, 400 times 40 seconds was wasting a big chunk of time.
As some of the Set statements went 15 layers deep to the various WPF objects, this was causing me some headaches everytime the WPF animation was updated.
I then started using the FindChild with starting with a top level branch then use the FindChild to find the test object.
Not only did this make my code look cleaner, But the 40 to 50 second initialization dropped to under 4 seconds.
Question is: Why is using FindChild, even with the search path looking through several long branches much faster than specifying each step of the long chain?
40 seconds down to under 4 seconds when using over 400 iterations is a huge time savings on my script Run time and I'm not complaining.
It just seems counter inuitive for have a search function run 10 times faster than specifying the entire string.
Any ideas why?
I've started using the FindChild routine in all of my subscripts and finding my scripts are running much faster.
Plus, whenever a developer changes something, it doesn't break my scripts. :)