Performance tweak for samples/display, resulting in a much faster application start, particularly when built in debug mode, when Windows messages are dumped to the system debug channel for inspection/diagnosis. Speed up the Append() loop below by foregoing the repeated resizing of the choice drop-down via repeated calls to GetBestSize() which happens deep inside the Append() call chain and executes another inner loop calling SendMessage() to get the control contents. (This exhibits 1/2*O(N^2) behaviour thanks to the linear growth of the length of the inner loop to the length of the outer loop (= number of items to add), while it is re-executed for every new added item.) With the 'display' sample, that's about 500+ rounds and about 500*500/2 SendMessage() calls less now on my dev/test rig, taking noticeable time to start the display application. --- Issue was found due to the barrage of '(winmsg)' Windows Message debug log lines zipping by in the monitor app when the sample was build in Debug Mode. Only significant difference with the Release Build is those debug lines being output, hence the performance gain is less, but still measurable, in a Release build. When the machine is otherwise severely loaded (UI render core maxing out), "measurable" becomes "obnoxiously noticeable" again on Win10/64. Closes #22049.
15 KiB
15 KiB