Skip to content

Look for the review where it lives, not across the whole desktop - #102

Merged
amrali-eg merged 1 commit into
masterfrom
perf/review-window-lookup
Sep 10, 2026
Merged

Look for the review where it lives, not across the whole desktop#102
amrali-eg merged 1 commit into
masterfrom
perf/review-window-lookup

Conversation

@amrali-eg

Copy link
Copy Markdown
Owner

One commit, one method. Independent of #101 - both touch EcGuiDriver.cs in
different places, so whichever merges second may want a rebase. No production
code changes.

The cost

FindReviewWindow searched TreeScope.Descendants from the desktop root, walking
every window of every running application - twice whenever the review was absent,
since it tried the identifier and then the title. It runs on every 50 ms poll of
several waits.

Measured directly, by timing the lookups rather than inferring from total runtime:

Desktop Review lookups Lookup time Suite wall clock
10 windows open 27 7900 / 7774 ms 22.7 / 22.3s
5 windows open 27 4148 / 4208 ms 18.9 / 19.1s

Same number of lookups either way. About 35% of a run was spent walking other
applications' window trees, and the price tracked what else the machine had on
screen - not something a test result should depend on. The measurement was
prompted by noticing that runs went faster with EC alone on a desktop.

Where the review actually lives

Measured, not assumed - after a first attempt scoped to the desktop's immediate
children found nothing and failed six runs out of six. An owned dialog is not a
top-level window. Probing all four scopes with a review open:

root/children=no   root/descendants=YES   main/children=YES   main/descendants=YES

It sits among the main window's own children, so that is where it is looked for,
with identifier or title in one condition instead of two searches. Scoping to the
main window makes the process filter redundant.

Automation errors are deliberately not caught here: returning null for one
would report the review as absent when the truth is that nothing could be read,
and the waits that call this already retry and keep the error. That erasure has
had to be fixed twice before in this driver.

Result

Before After
Cluttered desktop (10 windows) 22.7 / 22.3s 17.3 / 17.6s
Fresh desktop 18.9 / 19.1s 17.8 / 17.7s

The gap that tracked desktop clutter is gone, and it beats the old best case -
roughly 24% off the suite. Six consecutive full runs pass, four more standalone on
master after the split, and the unit suite is unchanged at 756.

Other descendant searches are left alone.

🤖 Generated with Claude Code

Review discovery searched TreeScope.Descendants from the desktop root, which walks
every window of every running application - twice whenever the review was absent,
because it tried the identifier and then the title. It runs on every 50 ms poll of
several waits.

Measured before changing anything, by timing the lookups directly rather than
inferring from total runtime: 7.9s and 7.8s of a 22.5s suite run on a desktop
holding ten windows, against 4.1s and 4.2s on one holding five. The cost tracked
what else the machine had on screen, which is not something a test result should
depend on. It was noticing that runs went faster with EC alone on a desktop that
prompted the measurement.

Where the review actually lives was measured too, after a first attempt scoped to
the desktop's immediate children found nothing and failed six runs out of six: an
owned dialog is not a top-level window. Probing all four scopes while a review was
open gives root/children=no, root/descendants=yes, main/children=yes,
main/descendants=yes. It sits among the main window's own children, so that is
where it is looked for, with identifier or title in one condition instead of two
searches. Scoping to the main window also makes the process filter redundant.

Automation errors are not caught here. Returning null for one would report the
review as absent when the truth is that nothing could be read, and the waits that
call this already retry and keep the error - the same erasure this driver has had
to fix twice before.

Full suite on the same cluttered desktop: 17.3s and 17.6s, against 22.7s and
22.3s before. On a fresh desktop: 17.8s and 17.7s - the gap that tracked desktop
clutter is gone, and it is faster than the old best case. Six consecutive runs
pass after the corrections, and the unit suite is unchanged at 756.

Other descendant searches are left alone.

EC is unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@amrali-eg
amrali-eg force-pushed the perf/review-window-lookup branch from f59434b to 0b0bc77 Compare September 10, 2026 08:09
@amrali-eg
amrali-eg merged commit ab1ec08 into master Sep 10, 2026
3 checks passed
@amrali-eg
amrali-eg deleted the perf/review-window-lookup branch September 10, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant