FindPathToWidget takes 3ms/frame in PIE if "new editor viewport" option is used

FSlateWindowHelper::FindPathToWidget has a fast mode and a slow mode (toggled via Slate.EnableFastWidgetPath). By default the fast mode is used by the game and the slow mode is used in the editor.

FEngineLoop::ProcessLocalPlayerSlateOperations uses this function to find the path to the game viewport.

If you use the “new editor window” PIE option, this starts taking several milliseconds per frame (dependent on how many windows/widgets you have active in the editor) because it recursively searches the widget hierarchy for each window in sequence. That is, it will traverse every single widget in the main editor window looking for the game viewport (it’s not in there).

I’ve tried just enabling the fast path cvar but it causes bugs in the revision control window and the blueprint editor. For now I’m extracting the fast version of FindPathToWidget to a separate function and calling that directly in ProcessLocalPlayerSlateOperations.

Forgot to mention: UE version 5.4